- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-10-2018 12:06 PM
Hello -
I was wondering how others are handling 3rd party outbound API responses from within a Service Catalog Request Item workflow? We have a system access request that once approved via the workflow moves to a 'Run Script' activity which is calling an Outbound API and passing variables from the Request into the payload and sending it out. While this is working properly for us, I am working on the best way to handle errors in the event that I do not receive the expected Response in the response body or from the response status.
In essence if I get a success I want to move on through the workflow, if I get a failure, I want it to pause there and trigger a notification.
The 3rd party system I am sending to, can actually come back and update the Request Item record, like set the value on a custom field to success or failure and I could use a 'Wait for Condition' activity until that is populated and then use an 'If' condition with a path from Success and a path from Failure, but I am not sure if that is ideal, or if there is a better way to approach this.
Thanks!
Solved! Go to Solution.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-10-2018 12:19 PM
Thinking about it, from the script activity you may also be able to use activity.result to set the result of the current activity, then just add transitions for your success and failure results. I haven't tried that, so I don't know if you have access to set activity.result, but worth a try and cleaner than scratchpad.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-10-2018 12:17 PM
If you just want to handle the response to REST call, I would suggest logging the result (http status and response body payload) to a workflow scratchpad variable. Then you could have an IF script after that activity that can check the scratchpad variables and then either continue or stop to handle the error.
If you want a separate transaction to come back from the third party system, then I think you will have to have a wait for condition (or workflow event) and have the external app update some field (possibly a variable).
A scripted REST service may be a good option here. If the system can send an ID for your requested item to the scripted endpoint, then you can fire a workflow event to the requested item's workflow and continue from there, possibly using one event for success and another for failure.
I would recommend the first approach (use the single REST transaction) if at all possible.
Hope that helps.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-10-2018 12:19 PM
Thinking about it, from the script activity you may also be able to use activity.result to set the result of the current activity, then just add transitions for your success and failure results. I haven't tried that, so I don't know if you have access to set activity.result, but worth a try and cleaner than scratchpad.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-10-2018 02:23 PM
This worked great! Thanks!

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-10-2018 02:25 PM
Awesome, glad that worked for you 🙂