Skip to main content

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​

FieldDescription
schemaAlways soln.runtime-context/v1
sourceFlow 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)
formLocal main form: id, apiName, name
recordLocal main record: id and data as a map of local field API names to values
input.transformedDataExternal field values produced by the transform node
input.transformedChildTablesChild table mapping result, described below
input.requestThe original input that triggered the flow
input.contextContext snapshot of this execution
resultAlways null before the script runs
runtimelocale, 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:

FieldDescription
localFormIdLocal child table form ID
externalObjectIdExternal child object ID
rowsChild rows, each holding only mapped external business fields

Three things to keep in mind when writing the script:

  • rows contain only mapped external business fields, without platform fields such as op, status, addedRows, updatedRows, or deletedRows
  • 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​

BehaviorDescription
AuthenticationThe 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
TimeoutStudio 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
RetryOnly 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
IdempotencyPass idempotency (a string or an object) from the script; the default header is Idempotency-Key, and nothing is sent when it is omitted