Custom Trigger Action Plugin



This action plugin can be used to script customized behavior in Ruby and to keep executing it until a condition is met.

Saved Parameters Description

  • Name: The name used to identify a saved CustomTrigger configured instance.
  • Comments: Some comments about this saved CustomTrigger configured instance.
  • Required inputs: Mandatory inputs for that action. Inputs need to be typed.
  • Optional inputs: Same as above but declared as optional inputs for the action.
  • Inputsspec code: Legacy. Not used anymore.
  • Validateinputs code: Legacy. Not used anymore.
  • Outputs: Outputs for that action.
  • Outputsspec code: Legacy. Not used anymore.
  • Execute code: The body of the ruby code to be executed once at the beginning.
  • Check status code: The body of the ruby code to be executed periodically at each polling period.
  • Support direct pause?: If checked, the action can be paused. Pausing will just block polling and not execute any additional pausing logic.
  • Support direct cancel?: If checked, the action can be cancelled along with the underlying process.
  • Polling frequency: The polling period. Default is 5 seconds.
  • Keep trigger on-going?: To use this plugin as a trigger. Spawn a new workorder each time the code terminates.

Inputs Description

The list of inputs depends on the configuration of the CustomTrigger action template.

The inputs for the action will be the ones declared in the 'Required inputs' and 'Optional inputs' section.

Outputs Description

The outputs optionally declared in the 'Outputs' section will be returned with their specified names and types.

Supported Actions

None

Operating Instructions

This plugin provides the ability to execute some ruby code repeatedly.

Inside the code, inputs can be accessed thru the inputs hash. The inputs have to be declared in the 'Required inputs' or 'Optional inputs' sections.

Outputs can be accessed thru the outputs hash.

In the 'Execute code' section, enter the code that must be executed once at the beginning.

In the 'Check status code', enter the code that must be executed repeatedly (at the defined polling frequency) until a termination status is returned.

To keep the processing on, return with Action::STATUS_INPROGRESS for status In Progress

To terminate the processing, return with Action::STATUS_COMPLETE for status Complete, Action::STATUS_FAILED for status Failed or Action::STATUS_ERROR for status Error

Sample code to check that a file transfer is complete based on the .aspx file extension:

When the file with this extension is present, the transfer is deemed incomplete. The file path is passed as input 'transferred_file', declared as String.

In the 'Execute code' section:

@file = inputs['transferred_file'] + ".aspx"

In the 'Check status code' section:

if File.exist?(@file)
   @status_details = "Transfer of file #{inputs['transferred_file']} on-going at #{DateTime.now}"
   @status = STATUS_INPROGRESS
else
   @status_details = "Transfer of file #{inputs['transferred_file']} is complete"
   @status = STATUS_COMPLETE
end

The status_details variable takes the data to display in the step status when the workflow is executed