- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-25-2016 03:34 PM
Hi, this is in relation to the following post: REST Activity error handling (Eureka)
I responded to the thread, but I don't think anyone's looking at it again, and I bit under the gun...
Basically, my question is this:
Can you explain why this works (and it does work for me), exactly?
var history = new GlideRecord('wf_history');
history.get(activity.previous_activity);
workflow.scratchpad.RESTError = history.output;
Specifically, the 2nd line and the "previous_activity" part. I know line two is get values from the activity field in the wf_history table, but how is properly matching up to the current request item with .previoius_activity?
I'm using this on a workflow script to pull in the XML (stored in wf_history table output field) of a SOAP response into a variable based on the above code:
var history = new GlideRecord('wf_history');
history.get(activity.previous_activity);
current.variables.aws_xml = history.output;
Will this always pull in the correct output into the correct RITM or RFTASK? Are there other activity.* calls like activity.current_activity?
Thanks!
Solved! Go to Solution.
- Labels:
-
Integrations
-
Scripting and Coding

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-26-2016 08:24 AM
If the activities are "far apart"... don't know. I might consider using the workflow scratchpad at that point.
http://wiki.servicenow.com/index.php?title=Using_the_Workflow_Scratchpad
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-26-2016 01:21 PM
Got it. Just needed to add the first code into a separate script activity instead of embedding it within the task.
Thanks for letting me hash this out and all the suggestions!
Chris

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-25-2016 04:42 PM
Let me know if that answered your question. If so, please mark it as correct so that others with the same question in the future can find it quickly and that it gets removed from the Unanswered list.
If you are viewing this discussion from your "inbox", use the "mark as correct" option under actions. If you are viewing it directly from the thread use the Correct Answer link (red with a star).
Thank you