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.

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, and property_name is the name of the attribute whose value you want to capture.

After the event successfully triggers the task or workflow, the variable will be populated with the resolved value of the specified property.

You can pass the name of the file that is monitored (MonitoredFileName), and the file path (MonitoredFilePath) where the file is located. The attributes associated with a file event can also be passed. The following associated attributes can be set as properties:
  • Workstation
  • EventRuleId
  • EventRuleName
  • FileName
  • JobStreamId
  • Hostname
  • SampleInterval
  • IPAddress
  • event
  • TimeStamp

Example

  1. 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.