Automatically setting assignment group if caller is from a certain state

kenneth2k1
Kilo Expert

Hi all:

I can't quite figure out how to automatically set the assignments group is the person reporting the incident/request is from a certain state. We have a number of users who should be assigned to a specific assignment group if their user account lists their city as Portland. It doesn't look like this can be done by an assignment rule, does this have to be worked into the workflow? If so, could you help me with the script syntax?  

Thanks for any help or insight on this!

1 ACCEPTED SOLUTION

Yes I had noticed that too



I fixed it, yet it still wasn't working as expected. First, I have discovered that there will need to be different methods for incidents and requests.



For example, for incidents, a business rule will get overridden by an assignment rule. And for requests, a business rule or client script will be overridden by a script that is run in a workflow. We have auto assignment happening by assignment lookup rules, assignment rules, and workflows depending on request or incident. So the answer is tricky.



2015-02-26_15-49-10.jpg



With servicenow help desk's help, we have been able to get a resolution by using an assignment lookup rule that runs on the incident table to assign to the desired group if the location is "Portland." The order is set so that it is before any other rule that sets an assignment group. So the other suggestions made in this thread might have worked, but there are multiple ways to auto assign the group, and these assignment data lookup rules always take precedent



...except with requests. Working with SN on those, since the technician was also having a difficult time determining what takes precedent over what, and what the proper way might be to set these (currently setting them in the workflow will probably be the solution).


View solution in original post

24 REPLIES 24

Could you try with script instead of setting values in business rule.



if(current.called_id.state == 'MIAMI')


{


current.u_time_to_assign.setDisplayValue('MIAMI Service Desk');


}


else if(current.called_id.state == 'FLORIDA')


{


current.u_time_to_assign.setDisplayValue('FLORIDA Service Desk');


}


thanks for the help. I have changed your script somewhat to what I am hoping is correct.



businessRule2.jpg



I have changed your "state" to "location" because that's what the name of the field is. let me know if I need to change it to something else. By the way, what's a good resource for all the different pieces of data that can be retrieved from current?


By using we can all data of current record.



inside if condition keep gs.log('inise if con'); and check logs either its printing or not.


kenneth2k1
Kilo Expert

LOL, now for some reason this forum won't let me post my response. Let's see if this simple post works...


kenneth2k1
Kilo Expert

I'm sorry but I don't know what you meant by "By using we can all data of current record"



2015-02-25_23-16-24.jpg


this returns callerLoc as "undefined" so it's not passing the location correctly. Is "current.called_id.location" correct to get the filled in "location" field from the incident record producer?  



The "location" is set by a Catalog Client Script that has this syntax set onLoad:



function onLoad() {




  var gajax = new GlideAjax("GetUserData");


  gajax.addParam("sysparm_name", "getFieldValue"); //method name


  gajax.addParam("sysparm_field", "location"); //data passed to the client script


  gajax.addParam("sysparm_sys_id", g_user.userID);


      gajax.getXMLAnswer(ajaxResponse); //use of callback function to return data rather than waiting for the server response.


      function ajaxResponse(answer){


              g_form.setValue("location", answer);


      }


}



Thoughts?