Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

A JavaScript Job can access arguments from a number of sources, see JS7 - Job API

...

Example: Reading specific Arguments

Code Block
languagejs
titleExample for implementation of JS7Job with JavaScript
linenumberstrue
class JS7Job extends js7.Job {
 
	    processOrder(js7Step) {
		var workflowPath
        // access argument by name
        js7Step.getLogger().info('[getAllArgumentsAsNameValueMap] by name:');
        var colorBlue = js7Step.getAllArgumentsAsNameValueMap()['js7Workflow.pathcolor_blue'];
	         js7Step.getLogger().info('argument: color_blue=' + workflowPathcolorBlue);
    }
}

Explanation:

  • The getAllArgumentsAsNameValueMap() method provides a map of all arguments. The map allows to read a single argument from the argument name.
  • For further methods to access arguments see JS7 - Job API

Example:

...

Reading the list of all Arguments

Code Block
languagejs
titleExample for implementation of JS7Job with JavaScript
linenumberstrue
class JS7Job extends js7.Job {
 
	    processOrder(js7Step) {
		        // get list of all arguments
        var args = js7Step.getAllArguments();
        js7Step.getLogger().info('[getAllArguments]:');
        js7Step.getLogger().info('all arguments: ' + args);
 
        for (var arg in args) {
			            js7Step.getLogger().info('argument: ' + arg + '=' + args[arg].getValue());
		        }
      }
}


Explanation:

  • The getAllArguments() method provides an array of argument objects for iteration.
  • For further methods to access arguments see JS7 - Job API

Further Resources

Features

Display content by label
Labelsjs7 api javascript
OtherTitleHow To ... JavaScript