Script to assign Tasks based on requestor location

Shawn Horley
Kilo Guru

Greetings Folks

So I am building Service Catalog items. And one of the things I am needing to build is a request form that gets auto-assigned to the appropriate group based on the location that is entered in the form. That Location field currently auto-populates based on the Requestor's location, and can be edited manually. So far so good, (I created the location hierarchy, and set parents for each of our 100+ locations) Now I need to figure the script I have to add to get the form to auto-assign to the appropriate group for the location entered on the form. 

My Challenge (because what would I do without challenges?) is that I'm a Neophyte scripter... in fact I may be insulting neophytes with that statement I am so Nooby(Noobish?) when it comes to creating script.

The only part I am relatively sure of is that I will need to have: "caller.location.parent" somewhere in it.

Any suggestions you could offer will be much appreciated as always.

Cheers

3 REPLIES 3

Mike Patel
Tera Sage

I would recommend to create new field on location like Support group and reference it to groups. Than on workflow you can say like task.assignment_group = current.variables.location.u_support_group;

If you can't do that than you can do below

if(current.variables.location.parent == "sysid of location"){

task.assignment_group = 'sysid of group')

}else{

task.assignment_group = 'sysid of default group')

}

Shashikant Yada
Tera Guru

What we have done is, we have created one more field on the Location table "Assignment Group".

And written the below code in the  catalog task activity:

task.assignment_group = current.location.u_assignment_group;

Hope this will work for you

Thanks
Shashikant

Hit Helpful or Correct on the impact of response.

Shawn Horley
Kilo Guru

Thank you Mike and Shashikant!

i will try your suggestions. I really appreciate the help!