- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-04-2019 06:25 AM
Hi,
I have an assignment rule for the incident table and a Record Producer to create Service Desk incidents. The idea is that if a custom variable value (current.variables.normal_user_yesno) in my Record Producer is "Yes" then to assign a group in the assignment rule OTHERWISE leave the assignment group field empty so other assignment rules can still try to populate the field.
For some reason it is not working, when the answer is "Yes" then I get the right assignment group assigned to the ticket, but when the answer is "No" the assignment group field in the ticket stay empty and none of the other assignment rules seem to work.
What do I need to do in an assignment rule to leave the field empty if the custom variable answer is "No"?
Code:
if ( current.variables.normal_user_yesno.toString() == 'Yes' ){
current.assignment_group = "9c2f3964db760f008f9f3c00ad961948";
}else{
current.assignment_group = "";
}
BTW, the "Group" field in the assignment rule is empty as well as the "user" field. I had generic Conditions in the assignment rule filter because the only thing that should make my assignment rule assign a group is when the variable value is "Yes"
Thank you
Solved! Go to Solution.
- Labels:
-
Incident Management

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-04-2019 08:36 AM
Your requirement best suits in script field on Record Producer form and use the below script
if ( producer.normal_user_yesno.toString() == 'Yes' ){
current.assignment_group = "9c2f3964db760f008f9f3c00ad961948";
}else{
current.assignment_group = "";
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-04-2019 07:19 AM
Try as current.setDisplayValue('assignment_group',' ')
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-04-2019 07:23 AM
Your script should be something like this.
if (producer.normal_user_yesno.toString() == 'Yes' ){
current.assignment_group = "9c2f3964db760f008f9f3c00ad961948";
}
else
{
current.assignment_group = "";
}
https://docs.servicenow.com/bundle/london-it-service-management/page/product/service-catalog-management/concept/c_PopulatingRecordData.html
Please mark my response as correct and helpful if it helped solved your question.
-Thanks
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-04-2019 07:50 AM
What order is this rule set to run in? If you want this to run first and then have others execute after it, set it to the lowest order. You shouldn't need the else statement, when the if condition is not satisfied it will just move on, there should be no value to clear.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-04-2019 08:05 AM
I did that, but none of the rules above mine were executing. It seems like the assignment rule would just assign "" and then skip all other assignment rules.
I originally didn't have the "else" block, but I added it to be sure it was not assignment anything. Still didn't work.