Passing Arguments

JS7 - JavaScript Jobs can pass arguments to subsequent jobs and instructions in a workflow:

  • Consider that JS7 - Order Variables and variables declared with the workflow or JS7 - Job Resources are constants. They cannot be modified and they cannot be passed, they are available to any jobs.
  • Jobs can add variables and can modify variables added by predecessor jobs.


Example for implementation of JS7Job with JavaScript
class JS7Job extends js7.Job {

	processOrder(js7Step) {
      	// do some stuff to calculate return values
        var someString = 'some string';
        var someNumber = 42;
        var someBoolean = true;
      
        // pass return values to subsequent jobs
        js7Step.getOutcome().putVariable( 'some_var_string', someString );
        js7Step.getOutcome().putVariable( 'some_var_number', someNumber );
        js7Step.getOutcome().putVariable( 'some_var_boolean', someBoolean );
     }
}


Explanation:

  • The getOutcome().putVariable() method specifies the name and value of the variable to be passed.
  • The name of the variable can be freely chosen within the scope of JS7 - Object Naming Rules.
  • Variable names are case-sensitive.

Further Resources