External Call
The External Call Instructions allow a Template/Script to communicate with an external server.
These Script Instructions make HTTP/HTTPS calls to an external server. They enable a Script to perform the following two functions:
Request data from an external server to be used in the Template/Script.
Push data from within the Template/Script to an external server.
The External Call category includes two types of Enhanced Script Instructions:
Flkw:GetExternalCallValue
Flkw:PostCallValue
These Script Instructions require the user to select the Identity. To know more about Identities, see Enterprise Identities.
The External Call Instructions Flkw:GetExternalCallValue
and Flkw:PostCallValue
may result in either a Success or an Error depending on the response of the external server. It is required to handle both these events differently.
This is done by including two JavaScript callback functions ( successCallback and errorCallback) as parameters to the External Call Instruction.
If the external call was performed successfully, then the function successCallback is invoked to follow a certain course of action.
If the external call was not successful and the external server returned an error, then the function errorCallback is invoked to follow a different course of action.
A sample set of callback functions are shown below. Both callback functions display the server response ( serverAnswer or error, as the case may be) and perform another Flkw:ExternalCallValue call, which has a different set of callback functions successCallback2 and errorCallback2.
![]() |
The callback functions successCallback2 and errorCallback2 are defined as shown below.
![]() |
Important
The successCallback and errorCallback must defined in the format window.successCallback
and window.errorCallback
Flkw:GetExternalCallValue
is an External Call Instruction that retrieves data from an external server and stores it in a Local Variable to use within the Template/Script.
Format: Flkw:GetExternalCallValue(url, payload, identityId, "successCallback", "errorCallback");
Parameters | Description |
---|---|
url | The URL of the website from which you want to request information. |
payload | Manipulations on the data. |
identityId | The ID of the value that you want to manipulate. |
successCallback | The action triggered if the request is successful. |
errorCallback | The action triggered if the request is not successful. |
To construct a Script Instruction using Flkw:GetExternalCallValue
:
Select
from the dropdown list. In the field, enter theFlkw:GetExternalCallValue
Instruction as shown. Note that the successCallback and errorCallback functions are defined before theFlkw:GetExternalCallValue
Instruction.
The Flkw:GetExternalCallValue
Instruction is added to the Script.
Flkw:PostCallValue
is an External Call Instruction that that pushes data to an external server from within the Template/Script.
Format: Flkw:PostCallValue("url","payload","identityId","successCallback","errorCallback");
Parameters | Description |
---|---|
url | The URL of the website on which you want to post information. |
payload | Manipulation on the data. |
identityId | The ID of the value that you want to manipulate. |
successCallback | The action triggered if the request is successful. |
errorCallback | The action triggered if the request is not successful. |
To construct a Script Instruction using Flkw:PostCallValue
:
Select
from the dropdown list. In the field, enter theFlkw:PostCallValue
Instruction as shown. Note that the successCallback and errorCallback functions are defined before theFlkw:PostCallValue
Instruction.
The Flkw:PostCallValue
Instruction is added to the Script.