Assignment Rule Script with conditions to set Assignment Group and Assigned to
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-10-2024 06:48 AM
Team,
Struggling to auto set assignment group and assign to on sc_req_item table.
Condition:
if , catalog item is 'Request'; checkbox variables - 'user_access_management' and 'sap' must be 'true'; Department of RITM 'Opened by' should be 'Finance & Accounting'
then RITM's assignment group assigned to 'Group X' and assigned to 'User X1' (Note: User X1 is a member of Group X)
else if
catalog item is 'Request'; checkbox variables - 'check_userguide' and 'suite' must be 'true'; Department of RITM 'Opened by' should be 'Quality'
then RITM's assignment group assigned to 'Group Y' and assigned to 'User Y1' (Note: User Y1 is a member of Group Y)
To achieve this I have wrote below script on assignment rule
if (current.cat_item == "Request" && current.variables.user_access_management == true && current.variables.sap == true && current.opened_by.department.name == "Finance & Accounting")
//current.setValue("assignment_group","b99151b31bb59d10a9714159cc4bcb77"); //sys_id of Group X
current.assignment_group.setDisplayValue("Group X");
current.assigned_to.setDisplayValue("User X1");
else if (current.cat_item == "Request" && current.variables.check_userguide == true && current.variables.suite == true && current.opened_by.department.name == "Quality")
//current.setValue("assignment_group","efc122b31bb59d10a9714159cc4b21c7"); //sys_id of Group Y
current.assignment_group.setDisplayValue("Group Y");
current.assigned_to.setDisplayValue("User Y1");
but it is not working as neither assignment group nor assigned to is auto setting.
Please help with the script
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-10-2024 07:18 AM
For checkbox variables, try comparing with "true" or 'true' instead.
Regards,
Sharad
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-10-2024 07:41 AM
@maroon_byte tried but no luck
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-10-2024 08:31 AM
Instead of script condition check, create separate assignment rules and add variables in conditions such as below:
If you dont see 'Variables' selection in condition, you will have to first look for 'Show Related Items' as seen below:
Regards,
Sharad
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-10-2024 07:18 AM
Hello @rishabh31,
Add logs to the scripts and check if you're getting the correct values and whether the control is entering the if block or not.