Join the #BuildWithBuildAgent Challenge! Get recognized, earn exclusive swag, and inspire the ServiceNow Community with what you can build using Build Agent.  Join the Challenge.

How to assign incidents depend upon the user location?

gokulraj
Giga Expert

Hi all,

  I have a requirement to assign the assignment group automatically for all incidents depends on the user location.I need a script for this.Please, suggest   your ideas.

27 REPLIES 27

Hi Gokulraj,



Please let me know the following :



1. In your location and group tables, the assignment group and location   fields are reference fields or string fields


2. Show me your code.



Regards,


Chandra


Hi Chandra Suvro Bose



referencr.PNGnot set.PNG




That is a reference field and that is my code,I was able to get the location and assignment group but not able to set the assignment group.


Hi Gokulraj,



Few observations:



1. I see both the fields are string type in the location and group tables


2. In addQuery line you should write u_location and not location. So your code does not execute the if


3. Do not use setValue in a business rule, it is a client side function, use current.assignment_group = group;


4. Since your assignment group is a string field and assignment group in incident form is reference field , there is a type mismatch while assignment.



Please fix the above points and let me know the result.



Regards,


Chandra


Hey Chandra Suvro Bose not executing.PNG




I had tried this,my If part is not executing.


Check two things:



1. whether the caller has any location   ?


2. show me the record in location and groups table which is being used to lookup