- 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-28-2015 12:02 PM
1. Add below as the first line in your code:
gs.log(current.variables.line_manager.sys_id,'YP');
2. Run the code
3. Go to System Logs and filter out the logs where the create date is Today and Source = YP
What value do you see in the log message? Can you share the screenshot of the log.
Regards,
Hardik Vora
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-28-2015 12:17 PM
- 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-28-2015 01:03 PM
You got it. That is the correct script. That worked for me just perfectly. Thanks a lot.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-24-2015 04:35 AM
is that reference field (line_manager) pointing to the right table (sys_user) ? Just to discard possible issues.