Passing attribute filters of file events as variables
The attribute filters of a file event that triggers a workflow or task can be passed as variables within the workflow or task definition. The attributes can be set as output properties in a workflow or task, or referenced as variables in task properties, or other relevant fields within the definition.
The attributes can be set as output properties in a workflow or task, or referenced as variables in task properties, or other relevant fields within the definition.
You can set the attributes as variables using the following syntax:
${js.trigger.event_condition_name.property_name}
Here, event_condition_name is the name of the event condition, and property_name is the name of the attribute or payload field whose value you want to capture.
After the event successfully triggers the task or workflow, the variable is populated with the resolved value of the specified property.
Passing IMAP email payload data
When using an IMAP email event trigger, you can dynamically pass email data (such as the subject, body, or sender information) into your tasks for processing. You can map the IMAP payload fields to task variables using the standard syntax.
For example, if your event condition is named EMAIL_RECEIVED, you can extract specific email properties as follows:
- Subject:
${js.trigger.EMAIL_RECEIVED.subject} - Sender email:
${js.trigger.EMAIL_RECEIVED.sender.email} - Body content:
${js.trigger.EMAIL_RECEIVED.body} - Recipient list:
${js.trigger.EMAIL_RECEIVED.to}
Passing file event attribute filters
For file events, you can pass the name of the file that is monitored (MonitoredFileName), and the file path (MonitoredFilePath) where the file is located. The following associated attributes can also be set as properties:
- Workstation
- EventRuleId
- EventRuleName
- FileName
- JobStreamId
- Hostname
- SampleInterval
- IPAddress
- event
- TimeStamp
Example
To pass the monitored file name (file_example.txt) and monitored
file path (/Users/user1/file_example.txt) variables of the event as
output properties of a task, create the
workflow
definition as follows:
---
kind: JobStream
def:
folder: /
name: JS_FILE_TRIGGER
workstation: /CLOUD
saturdayIsFree: true
sundayIsFree: true
eventTriggers:
- name: TRIG
triggerOnTimeout: false
inOrder: false
eventConditions:
- name: FM_CREATE
eventPlugin: FileMonitor
eventType: FileCreated
scope: /Users/user1/file_example.txt on /UNO_AGT_LNX
attributeFilters:
- name: FileName
operator: EQ
values:
- /Users/user1/file_example.txt
- name: SampleInterval
operator: EQ
values:
- 1
- name: Workstation
operator: EQ
values:
- /UNO_AGT_LNX
priority: 10
asap: false
perJobLatestStart: false
matchingCriteria:
type: previous
resourceDependencies: []
jobs:
- name: JOBDEF1
jobDefinitionRef: /WS_AGT_1#/JOBDEF1
workstation: /WS_AGT_1
priority: 10
asap: false
resourceDependencies: []
outputProperties:
- name: fileNameJdLvl
value: "${js.trigger.FM_CREATE.MonitoredFileName}"
- name: filePathJdLvl
value: "${js.trigger.FM_CREATE.MonitoredFilePath}"
After the workflow is triggered, the task properties
that are displayed by the showjob command with
;props option contain the following:
fileNameJdLv1 = file_example.txt
filePathJdLv1 = /Users/user1/file_example.txt
Similarly, if workflow properties
are defined, they are displayed by the showsched command with
;props option.