Autopopulate assignment group based on user's location

Balaji Munusamy
Tera Contributor

If the caller's location is 'London' , assignment group should auto populate as 'London Group'. Here assignment  group is reference field.

@Ankur Bawiskar  @Community Alums  @Sohail Khilji 
can you assist me on this?

2 ACCEPTED SOLUTIONS

Ankur Bawiskar
Tera Patron

@Balaji Munusamy 

you can use assignment rule for this.

Did you explore that?

Regards,
Ankur
✨ Certified Technical Architect  ||  ✨ 10x ServiceNow MVP  ||  ✨ ServiceNow Community Leader

View solution in original post

Not applicable

Hi @Balaji Munusamy ,

I agree with Ankur on using Assignment rule!!

Also, if you want to go script way then,

Try creating a before business rule :- 

(function executeRule(current, previous /*null when async*/) {



// Add your code here


var userLoc = current.caller_id.location;


var gr = new GlideRecord('sys_user_group');


gr.addQuery('PASS LOCATION FEILD COLUMN HERE', userLoc); //Assuming this field is a reference field

gr.query();

if(gr.next());

{

current.assignment_group = gr.sys_id;

}




})(current, previous);

 

 

View solution in original post

3 REPLIES 3

Ankur Bawiskar
Tera Patron

@Balaji Munusamy 

you can use assignment rule for this.

Did you explore that?

Regards,
Ankur
✨ Certified Technical Architect  ||  ✨ 10x ServiceNow MVP  ||  ✨ ServiceNow Community Leader

@Balaji Munusamy 

Thank you for marking my response as helpful.

If my response helped please mark it correct and close the thread so that it benefits future readers.

Regards,
Ankur
✨ Certified Technical Architect  ||  ✨ 10x ServiceNow MVP  ||  ✨ ServiceNow Community Leader

Not applicable

Hi @Balaji Munusamy ,

I agree with Ankur on using Assignment rule!!

Also, if you want to go script way then,

Try creating a before business rule :- 

(function executeRule(current, previous /*null when async*/) {



// Add your code here


var userLoc = current.caller_id.location;


var gr = new GlideRecord('sys_user_group');


gr.addQuery('PASS LOCATION FEILD COLUMN HERE', userLoc); //Assuming this field is a reference field

gr.query();

if(gr.next());

{

current.assignment_group = gr.sys_id;

}




})(current, previous);