- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-22-2015 08:05 AM
I have an item on the service catalog that contains a reference variable called "Line Manager". I need to modify the workflow, so an activity can be included to create a task for the "Line manager" to approve the request.
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-28-2015 12:10 PM
I see it now. You are running that workflow on the request table and not the Request Item as I thought. That is why the activity is being skiped. Please add the following script on the approval activity and let me know if it works (Might need to work further):
//Begin Script
answer = [];
var item = new GlideRecord('sc_req_item');
item.addQuery('request', current.sys_id);
item.query();
while (item.next()) {
if( (item.variables.line_manager != '') {
answer.push(item.variables.line_manager.sys_id);
}
}
//End Script
Note: If it did not work with "answer.push(item.variables.line_manager.sys_id);" please try again with "answer.push(item.variables.line_manager);"
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-22-2015 08:18 AM
Depends slightly on if you're using an Approval Group or an Approval User. Both activities have a script section where you can script in the answer (answer being hte list of approvers/approval groups).
In your case it sounds like you're using Approval User.
Your script will look something like this:
var id1 = current.variables.line_manager; //or whatever the name of your variable *actually* is.
answer = [];
answer.push('id1');
Smash that answer button!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-22-2015 08:33 AM
Thanks for the answer. I am indeed using an Approval User and my Variable is called line_manager as stated on your answer, but still adding the script on the approval user activity, it is not actually generating the approval for the line manager. It is only creating one approval task which I have setup in a different activity. Here is my workflow and the activity.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-22-2015 08:38 AM
*head desk*
My fault. You shouldn't have quotes around id1.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-22-2015 11:18 AM