External API Call – Custom JavaSript Reference

You can use the beforeJS and afterJS settings to set up custom JavaScript code to be executed before and after an API call. The following objects are available in this context:

Object Description
instanceId ID of the External API instance.
integrationProcessDetailId ID of the API call.
contextEntityName Name of the entity for which the External API is run.
contextUniqueId ID of the contextEntityName record.
runAsync Either true or false depending if the External API is run asynchronously or not.
requestParamsBeforeJs Includes static parameters and their values to be passed to the HTTP request.
requestParams Parameter - value pairs to be passed to the API call. You can edit this object to include requestParamsBeforeJs and/or dynamic parameters, such as an authentication token obtained in a prior step or values from the contextEntityName record.
IMPORTANT!
This is a mandatory object that must be returned by the beforeJS code.
skippedFromBeforeJs If set to true, the API call is skipped. Otherwise, it should be set to false.
IMPORTANT!
This is a mandatory object that must be returned by the beforeJS code.
responseAsString HTTP response of the API call in string format.
resultAsjson Indicates if the API call was successfull (resultAsjson.isSuccess = true;) and the response message (resultAsjson.message = "!OK!";).
IMPORTANT!
This is a mandatory object that must be returned by the afterJS code.