- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-22-2016 09:21 AM
Hi,
I need to create an incident in an orchestration workflow that is on the em_alert table. Since this isn't extended from the task table i cannot use the 'Create Task' activity so i'm using the 'Run Script' activity to create the incident. I want to add information into the incident's short_description from the output of previous activities in the workflow, but i'm unable to determine how to reference those output variables in the 'Run Script' activity. For example one of the previous activities performs a rest call and has an output of error, which is mapped to the activityOutput.error. How can I use the value of this output variable in my 'Run Script' activity so i can add it to the short_description in the incident i'm creating?
Anyone know how i can do this?
Thanks,
David
Solved! Go to Solution.
- Labels:
-
Service Mapping
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-22-2016 10:03 AM
David,
It sounds like your previous REST activity is a Custom Activity based on the fact that you state it is writing to activityOutput.error. activityOutput is an object that only exists within the structure of the Custom Activity. When the Custom Activity is used on your Workflow canvas, all the outputs defined in activityOutput become variables available on the Data palette tab on the right side of the Workflow Editor.
You can drag it from the Data tab and drop it into many fields from this location when editing Activity information on the canvas. Script fields are an exception here. Instead, you need to expand the script tree at the right side of the script field. You can expand out Activities, and access all the outputs from the Custom Activity simply by clicking on them to insert them into your script (be sure your cursor is in the location where you want to drop it in the script). The variables take the form of data.get(index).variableName.
Here's a picture. I hope this gets you going.
Ben

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-22-2016 09:34 AM
You can use workflow scratchpad variables to pass the information to the subsequent activities. Go thru this link, this will get you what you need.
http://wiki.servicenow.com/index.php?title=Using_the_Workflow_Scratchpad#gsc.tab=0
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-22-2016 09:45 AM
Hi Abhinay,
I could modify the activity to add scratchpad variables. Is there not a way to access the value of the output directly?
Thanks,
David Bernard

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-22-2016 09:51 AM
Try using activity.output
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-22-2016 10:03 AM
David,
It sounds like your previous REST activity is a Custom Activity based on the fact that you state it is writing to activityOutput.error. activityOutput is an object that only exists within the structure of the Custom Activity. When the Custom Activity is used on your Workflow canvas, all the outputs defined in activityOutput become variables available on the Data palette tab on the right side of the Workflow Editor.
You can drag it from the Data tab and drop it into many fields from this location when editing Activity information on the canvas. Script fields are an exception here. Instead, you need to expand the script tree at the right side of the script field. You can expand out Activities, and access all the outputs from the Custom Activity simply by clicking on them to insert them into your script (be sure your cursor is in the location where you want to drop it in the script). The variables take the form of data.get(index).variableName.
Here's a picture. I hope this gets you going.
Ben