The CreatorCon Call for Content is officially open! Get started here.

Assignment Rule Script with conditions to set Assignment Group and Assigned to

rishabh31
Mega Sage

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

5 REPLIES 5

maroon_byte
Mega Sage

For checkbox variables, try comparing with "true" or 'true' instead.

 

Regards,

Sharad

@maroon_byte tried but no luck

Instead of script condition check, create separate assignment rules and add variables in conditions such as below:

 

maroon_byte_2-1712763073702.png

 

 

If you dont see 'Variables' selection in condition, you will have to first look for 'Show Related Items' as seen below:

 

maroon_byte_1-1712762968670.png

 

Regards,

Sharad

Unique45
Mega Sage
Mega Sage

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.

 

Please mark correct/helpful if this helps you!