Outbound Script Payload
Outbound flows call the external system through a Studio script. The endpoint, method, and request body belong to the external API and are not defined by Soln. What Soln defines is what the script receives: when execution reaches the target node, the script gets the payload below with the schema soln.runtime-context/v1.
In the canvas, the inspector of the target node shows the same structure under Script input example, so the script can be written against it directly.
Payload Structure
| Field | Description |
|---|---|
schema | Always soln.runtime-context/v1 |
source | Flow and execution info: flowId, flowCode, bindingId, executionId, direction (outbound), stage (target), plus trigger.mode (execution type), trigger.action (the action of this run), and trigger.actions (the configured push actions) |
form | Local main form: id, apiName, name |
record | Local main record: id and data as a map of local field API names to values |
input.transformedData | External field values produced by the transform node |
input.transformedChildTables | Child table mapping result, described below |
input.request | The original input that triggered the flow |
input.context | Context snapshot of this execution |
result | Always null before the script runs |
runtime | locale, timezone, executionId, traceId |
draft, selection, and child are empty or empty arrays for outbound target execution and are not needed.
input.transformedData
Keys are external field codes and values are the result after match fields, option mapping, and subject mapping. Fields that no mapping uses do not appear.
input.transformedChildTables
An array where each item only contains:
| Field | Description |
|---|---|
localFormId | Local child table form ID |
externalObjectId | External child object ID |
rows | Child rows, each holding only mapped external business fields |
Three things to keep in mind when writing the script:
rowscontain only mapped external business fields, without platform fields such asop,status,addedRows,updatedRows, ordeletedRows- Child rows that were deleted locally are absent from the snapshot
- To detect which rows must be deleted on the external side, the script has to read the external current state and reconcile it against
rows
Script Example
export default async function main(
payload: StudioScriptRuntimeContextPayload,
context: StudioScriptContext
) {
const { transformedData, transformedChildTables } = payload.input;
const response = await context.http.requestJson({
method: 'POST',
url: 'https://partner.example/api/orders',
json: {
order: transformedData,
lines: transformedChildTables[0]?.rows ?? [],
},
timeoutMs: 20_000,
idempotency: { key: 'order-' + payload.record.id },
});
return { ok: true, externalId: response.data.id };
}
Outbound Request Behavior
| Behavior | Description |
|---|---|
| Authentication | The runtime adds the credential headers of the outbound auth profile of that OpenLink and replaces same-named headers set by the script, see Outbound Auth |
| Timeout | Studio scripts run with a 30 second limit by default and OpenLink integration scripts use 60 seconds; single HTTP requests inside a script should use a shorter timeout |
| Retry | Only one attempt by default; pass retry from the script to retry, with 408, 425, 429, 500, 502, 503, and 504 as the default retryable status codes |
| Idempotency | Pass idempotency (a string or an object) from the script; the default header is Idempotency-Key, and nothing is sent when it is omitted |