Approval workflow based on location
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-22-2017 11:28 AM
I need to create a approval script based on location of requester based on a variable in the request.
basically something like
IF location.requestor = 014 then get approval from "014 -store approvers" group
If location.requestor = 001 then get approval from " 001 -store approvers" group
I wouldn't mind if I had to manually write the if statements out.
Any help would be greatly appreciated.
- Labels:
-
Scripting and Coding

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-22-2017 11:47 AM
Hello Tim,
Select the approval group activity on the workflow with advanced checkbox set to true. Script will be
//Initialize an answer array to be returned
var answer = [];
if(current.location.requestor == 'VALUE1')
{
answer.push('PASS GROUP SYS_ID HERE');
}
if(current.location.requestor == 'VALUE2')
{
answer.push('PASS GROUP SYS_ID HERE');
}
Please make small change in the above code i.e instead of hardcoding sys_id, you can GlideRecord the group table and push the exact sys_id of the exact group
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-04-2017 07:30 AM
What I ultimately ended up doing is adding fields on the location table(EX: Equipment Approver). I made them as reference fields to the Sys_user_group table.
Then I made groups for each store. Each store's groups would be populated with the appropriate approvers.
so under location > "Equipment approvers" for store 014 I added the group "014- Equipment Approvers"
then in a workflow I added an approval group activity.
answer = current.variables.u_employee_location.u_equipment_approvers.toString();