Typically, a process flow run is triggered and a request for data is made via a connector shape - if the request is successful, data is retrieved and the flow continues.
However, there may be scenarios where you need to control whether the connector shape or process flow run should fail or continue based on information returned from the connection request. To achieve this you can apply a post-request
script to your endpoint.
When a post-request
script is added to an endpoint, it is applied wherever that endpoint is used in process flows. If your post-request
script should only be applied to specific flows, we recommend applying it as a response script for the connector shape in required flows. For more information please see: Using connector shape response scripts.
In the context of endpoints, post-request
scripts and response scripts
are the same thing.
A post-request
script receives the response code, headers, and body from connection requests and - utilising response_code
actions - returns a value determining whether the connector shape/flow run continues or stops.
Post-request
scripts are written and deployed in the usual way, via the custom scripts option. However, two additional options can be used: response_code
and message
. For more information about working with these options, please see: Using connector shape response scripts.
If a connector shape is configured for an endpoint associated with a post-request
script AND a response script
is applied in connector shape settings, the connector shape takes precedence. In this scenario, the response script
applied in the connector shape is used and the post-request
script applied to the endpoint is ignored.
Any script you want to apply must be created as a custom script first.
Step 1
Select the post-request script
tab for your endpoint:
Step 2
Click in the select a script
field and choose the script that you want to use - for example:
All scripts created for your company are available for selection.
Step 3 Choose the script version that you want to use:
If your script is updated in future, remember to come back here and (if appropriate) select the later version.
Step 4
Review the script code to be applied, then click the save and go back
button:
If you need to change the script code, this should be done in the custom scripts area, then (if appropriate) come back in and update the script version here.