Assignment Rules and catalog tasks

Derek10
Tera Expert

Hi all,

 

I'm looking to have an assignment rule that runs when there is a blank catalog rule from a specific catalog item. (Not a RITM but the actual item itself)

 

Long and short is that if it is a catalog task from that item I want it to be routed based on location field of the requested user's profile record.

 

I'm trying to do this outside of workflow as I have to accommodate over 80 sites. I'm currently trying to do what was listed here:

 

Accessing a variable in an Assignment Rule in Catalog

 

but am not having any luck at all. I'm fairly new to service now and am trying to see the best approach. I currently have my catalog task in the workflow set to be blank, (no assignee or asignee group) to make this happen.

 

Looking for best approach options here.

 

Thanks!

1 ACCEPTED SOLUTION

Brad Tilton
ServiceNow Employee
ServiceNow Employee

You could do something like that, although I would highly recommend populating your locations with this data so you don't need a bunch of if/else statements.



Your script should look something like this. I'm using setDisplayValue() and getDisplayValue() so you can work with the friendly names of your groups and locations rather than their sysids:


var loc = current.request.requested_for.location.getDisplayValue();


if (loc == 'Location1' || loc == 'Location2' || loc == 'Location3') {


      task.assignment_group.setDisplayValue('USA Support');


} else if (loc == 'Location4' || loc == 'Location5' || loc == 'Location6') {


  task.assignment_group.setDisplayValue('Canada Support');


} else {


    task.assignment_group.setDisplayValue('Global Support');


}


View solution in original post

8 REPLIES 8

Thanks for the assistance, it looks like we will be doing the static code, but if you know of an improvement to make this more dyamic please let me know!


Derek,


I was able to accomplish this using Assignment rules for one particular Catalog Item and it does route to the appropriate Assignment group for the location of the user.   The assignment rule runs on the sc_task table and the conditions are built specifically so they only run for this one catalog item.  


If you are still looking for a solution, here are the conditions I have used so you'll have an idea.   In my case, the user's locations are also populated from AD so at the end I do have a "catchall" rule in case the locations do not match any of the states/cities/countries I have set up.


find_real_file.png



find_real_file.png


Hope this help you or someone else perhaps!


Cheers!


Chandra


Thanks for the alternative! I have it working currently by doing on the advanced script   and following


  1. task.assignment_group = current.request.requested_for.location.u_support_group;  



I have the location check as a overall subflow so that if there is a site without a location it will open up a ticket, then after task closure will continue to recheck for updates. That way the flow doesn't die incomplete.




There are many different approaches to getting this working,   I will add your approach to my notes. As the way you are doing it is outside workflow, so its good to know.




Thanks again,




Derek


You are correct Brad, the best way was to utilize another field instead of all the if\thens.