09/18/2023
08:17 AM
- last edited on
09/20/2023
02:55 AM
by
Sunil
Hi Team,
I have created a dynamic attribute in the custom form attribute type as Multi Select From SQL query to fetch the user's sav roles detail.
And we have a requirement that Manager (having sav role Role_manager) can generate a scramble ID for their direct reportees and User having Admin sav role can generate a scramble ID for everyone except himself/herself.
If a user will have two sav roles (Admin, role_manager) and user has to remove one sav role to select the action -
and requestor selected a manager sav role and tries to submit the form with the below validation condition -
${(selectAction == 'Generate Scramble OTP' && RequestorUserID != username && RequestorUserID == managerID && status == 'Active' && loggedInUserRole == 'Manager') || (selectAction == 'Generate Scramble OTP' && RequestorUserID != username && status == 'Active' && loggedInUserRole == 'Admin')}
This is not allowing a user to submit the form since the loggedInUserRole dynamic attribute type is Multi Select From SQL Query.
Could you please guide me how can we use this feature ?
Regards,
Sujata
[This message has been edited by moderator to mask PII info]
09/18/2023 01:17 PM
Hi @sxm1067 ,
As loggedInUserRole is a MultiSelect Query, any chance you can try to replace loggedInUserRole == 'Manager' with loggedInUserRole.contains('Manager') and give it a try ?
09/19/2023 07:19 AM - edited 09/19/2023 07:32 AM
loggedInUserRole.contains('Manager') does not work in the validation condition. I have to use == . The functionality is still not working with either expressions.
09/19/2023 08:13 AM
Hi @krecpond ,
Any chance you were able to get the logs to see if there is any error or prompting values of the dynamic attribute format ?
09/20/2023 01:58 AM
Hi @adriencosson ,
I could see the below error in the logs -
I had two sav role assigned (Admin and Manager) and below is the selectAction dynamic attributes query -
SELECT 'Immediate Exit' AS id FROM users WHERE ${loggedInUserRole} = 'HR' UNION SELECT 'Immediate Exit' AS id FROM users WHERE ${loggedInUserRole} = 'Admin' UNION SELECT 'Disable EFX Login ID' AS id FROM users WHERE ${loggedInUserRole} = 'Admin' UNION SELECT 'Enable EFX Login ID' AS id FROM users WHERE ${loggedInUserRole} = 'Admin' UNION SELECT 'Enable ServiceNow Global ID' AS id FROM users WHERE ${loggedInUserRole} = 'Admin' UNION SELECT 'Internal Investigation' AS id FROM users WHERE ${loggedInUserRole} = 'Admin' UNION SELECT 'Internal Investigation' AS id FROM users WHERE ${loggedInUserRole} = 'Internal Investigation' UNION SELECT 'Enable EFX Login ID' AS id FROM users WHERE ${loggedInUserRole} = 'Internal Investigation' UNION SELECT 'Enable EFX Login ID' AS id FROM users WHERE ${loggedInUserRole} = 'MANAGER' UNION SELECT 'Generate Scramble OTP' AS id FROM users WHERE ${loggedInUserRole} = 'Admin'
Regards,
Sujata
09/20/2023 02:11 AM
Hi @sxm1067 ,
Good, so it looks that the list of multi Select is displayed as 'Admin','Manager'
Then, you might try the below and let us know if it works for you :
loggedInUser.replaceAll("'","").split(",").contains('Manager')
This would transform the attribute from String to an Array and then checks if it contains the appropriate value.
09/20/2023
02:30 AM
- last edited on
09/20/2023
02:52 AM
by
Sunil
Hi @adriencosson ,
Now I am not seeing the error but the functionality we want is If i have two sav roles assigned (Admin and Manager) and i am removing admin role in the form so that as per the validation conditions I should be able to submit the form only for my direct reportees.
I removed the admin -
and the validation query -
${((selectAction != currentSelectAction && currentSelectAction != 'Immediate Exit') && (((selectAction == 'Enable EFX Login ID' && status != 'Active' && customproperty47 != 'TRM') && (selectAction == 'Enable EFX Login ID' && status != 'Active' && customproperty47 != 'ITRM') && (selectAction == 'Enable EFX Login ID' && status != 'Active' && customproperty47 != 'CONV')) || ((selectAction == 'Disable EFX Login ID' && status != 'Inactive') || (selectAction == 'Enable ServiceNow Global ID' && status == 'Active' && snowStatus != 'Active') || (selectAction == 'Internal Investigation' && statuskey == 'Active') || (selectAction == 'Immediate Exit') || (selectAction == 'Enable EFX Login ID' && RequestorUserID != username && RequestorUserID == managerID && status != 'Active' && loggedInUser.replaceAll("'","").split(",").contains('Manager')) || (selectAction == 'Enable EFX Login ID' && status != 'Active' && loggedInUser.replaceAll("'","").split(",").contains('Admin')))))}
In this above both the highlighted conditions are getting satisfied. If i am removing admin sav role in the form then It should only allow me to submit the form for my reportees.
Regards,
Sujata
[This message has been edited by moderator to mask PII info]
09/20/2023 08:28 AM
@sxm1067 , If I well understood your requirement :
You can submit only if you do not have the "Admin" as you removed it from the list of SAV Roles.
Therefore either :
09/22/2023 09:04 AM
The use of contains works now. We have been able to implement this by configuring a validation between SAV roles and the drop down action items and and configuring a validation condition in Global Config under Identity Lifecycle --> Register User Form to prevent managers from generating a Scramble ID for users who are not their direct reportee.