- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-01-2016 06:39 PM
Hello Community,
I tried following this forum but it didn't work for me:
How to add Manager Approval in workflow based on custom item variable
So what I want to do is for the manager field of a request, I would like that manager that is filled out in that field to be the RITM is assigned to for approval:
I have supplied the following screen shots below:
Here is the Request form:
Here is the name of the manager field:
Here is where I want to populate the "Assigned to" field to what was populated in the managers field from the request form:
Here is the work flow associated with the Request:
I tried putting in this code to have it transfer the manager variable to the "Assigned to" field of the request:
Please let me know what I am doing wrong. Any help would be greatly appreciated.
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-08-2016 01:06 PM
Hello Everyone,
So I was able to resolve this by doing the following:
I created the following items on the work flow:
The script for the Run Script:
assigntomanager();
function assigntomanager() {
gs.log("Assigning Request Item to Requester's Manager");
//var assigntomanager = new GlideRecord('sc_rq'); no need to make glideRecord, your workflow is on sc_req_item table so current refers to current record of //sc_req_item itself
//assigntomanager.current.assigned_to = current.variables.manager; // no need to add assigntomanager before current object, wrong syntax
current.assigned_to = current.variables.manager ; // correct syntax
}
and I had to use a script since the approver of the request could change and the variable field was dynamic. The Advance script for the Approval - User:
// Set the variable 'answer' to a comma-separated list of user ids and/or group ids or an array of user/group ids to add as approvers.
//
// For example:
//gs.log("starting approval script");
answer = [];
// answer.push('current.variables.manager');
answer.push(current.variables.manager);
//answer = current.variables.manager;
//gs.log(" variable is " + current.variables.manager + " answer is " + answer);
now the manager of the requested_for user will be set as the approve on the Request Item (RITM).
Thank you all for your assistance.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-01-2016 10:49 PM
So when I tried to use the wait for condition, it works and awaits for the manager to approve it. However, the approval email is not sent to the manager.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-01-2016 09:41 PM
Hi Orlando,
In work flow your using "Approval - Group" activity. Can replace it with "Approval - User" activity.
Approval - Group --> If you need approval from group
Approval - User --> if you need approval from individual users
You need approval from manager(user), so you need to use "Approval - User" activity.
If this resolves your issue then please mark post as correct answer.
-Giri
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-01-2016 10:36 PM
Thank you Giri,
I have swapped the approval group, to approval user. However the approval user is based on the variable name that is filled out in the request so I had to use a script to assign rather than looking for one person all the time to assign these request to.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-08-2016 01:06 PM
Hello Everyone,
So I was able to resolve this by doing the following:
I created the following items on the work flow:
The script for the Run Script:
assigntomanager();
function assigntomanager() {
gs.log("Assigning Request Item to Requester's Manager");
//var assigntomanager = new GlideRecord('sc_rq'); no need to make glideRecord, your workflow is on sc_req_item table so current refers to current record of //sc_req_item itself
//assigntomanager.current.assigned_to = current.variables.manager; // no need to add assigntomanager before current object, wrong syntax
current.assigned_to = current.variables.manager ; // correct syntax
}
and I had to use a script since the approver of the request could change and the variable field was dynamic. The Advance script for the Approval - User:
// Set the variable 'answer' to a comma-separated list of user ids and/or group ids or an array of user/group ids to add as approvers.
//
// For example:
//gs.log("starting approval script");
answer = [];
// answer.push('current.variables.manager');
answer.push(current.variables.manager);
//answer = current.variables.manager;
//gs.log(" variable is " + current.variables.manager + " answer is " + answer);
now the manager of the requested_for user will be set as the approve on the Request Item (RITM).
Thank you all for your assistance.