The Input context setting in a Rules 2.0 transformation controls the root of the data that your JSONPath expressions read: the record alone, or an envelope that wraps the record with runtime data. This reference lists the two input contexts, every object the envelope contains, and how to reference each one with JSONPath and handlebars. Use it when your transformation needs job details, flow settings, webhook request data, HTTP response headers, or file metadata.
Input context options
Choose record when your rules only need the record's business data, or envelope when they need runtime data. For how each context sets the root of your paths, see Input context.
Changing the input context changes the paths your existing rules need. If you switch from record to envelope, update each input field path to start with $.record..
Envelope objects
The envelope contains the following objects. Some objects are present only for certain step types.
| Object | Contents | JSONPath | Handlebars | Available on |
|---|---|---|---|---|
record |
The record being transformed. | $.record.<field> |
{{record.<field>}} |
Exports and lookups |
job |
The current job: _id, type, startedAt, and a parentJob object with its own _id, type, startedAt, and flowExecutionGroupId. |
$.job._id |
{{job._id}} |
Exports and lookups |
settings |
Custom settings in scope, grouped as integration, flow, flowGrouping, connection, iClient, and export. |
$.settings.flow.<setting> |
{{settings.flow.<setting>}} |
Exports and lookups |
testMode |
true when the step runs in test mode or a preview. |
$.testMode |
{{testMode}} |
Exports and lookups |
lastExportDateTime |
Timestamp of the previous export run. | $.lastExportDateTime |
{{lastExportDateTime}} |
Delta exports |
currentExportDateTime |
Timestamp of the current export run. | $.currentExportDateTime |
{{currentExportDateTime}} |
Delta exports |
queryParams |
Query parameters from the incoming request, as key-value pairs. Parameter names keep the case the sender used. | $.queryParams.<name> |
{{queryParams.<name>}} |
Webhook listeners |
headers |
Request headers (webhook listeners) or response headers (HTTP exports and lookups), as key-value pairs. Header names are lowercase. | $.headers.<name> |
{{headers.<name>}} |
Webhook listeners, HTTP exports, HTTP lookups |
fileMeta |
Metadata for the file the record came from. For field details, see the file metadata table that follows. | $.fileMeta.<field> |
{{fileMeta.<field>}} |
File provider exports and lookups |
JSONPath expressions are case-sensitive. $.headers.Content-Type returns nothing when the header is stored as content-type.
File metadata fields
When a Rules 2.0 transformation runs on a file provider export or lookup and Input context is set to envelope, the envelope includes a fileMeta object for the file each record came from. When one run processes several files, each record receives the fileMeta of its own file.
| Field | Data type | Description | JSONPath | Handlebars |
|---|---|---|---|---|
fileName |
string | Name of the source file. | $.fileMeta.fileName |
{{fileMeta.fileName}} |
lastModifiedTime |
string (ISO 8601) | Date and time the file was last modified. | $.fileMeta.lastModifiedTime |
{{fileMeta.lastModifiedTime}} |
fileSize |
number | Size of the file in bytes. | $.fileMeta.fileSize |
{{fileMeta.fileSize}} |
The following file providers supply fileMeta:
- FTP, SFTP, and FTPS
- Amazon S3
- AS2
- Google Drive
- Box
- Dropbox
- NetSuite File Cabinet (File Provider)
- HTTP File
fileMeta isn't available when Input context is set to record. Pre-save page hooks that read file metadata work the same way regardless of the input context setting.
Sample envelope
The following sample shows the envelope for a record received by a webhook listener. Values are examples.
{
"record": {},
"queryParams": {
"param1": "value1",
"param2": "value2"
},
"headers": {
"content-type": "application/json",
"x-event-type": "order"
},
"job": {
"_id": "674893fd5438cd338353f770",
"type": "export",
"startedAt": "2024-11-28T16:02:05.497Z",
"parentJob": {
"_id": "674893fd5438cd338353f771",
"type": "flow",
"startedAt": "2024-11-28T16:02:00.497Z",
"flowExecutionGroupId": "674893fd5438cd338353f772"
}
},
"testMode": false,
"settings": {
"integration": {},
"flow": {},
"flowGrouping": {},
"connection": {},
"iClient": {},
"export": {}
}
}