Page History
...
A JavaScript Job can access arguments from a number of sources, see JS7 - Job API.
...
- The straightforward way how to read arguments is explained from the next chapter.
- For more detailed access methods see JS7 - How to read arguments in JavaScript Jobs
Example: Reading specific Arguments
Code Block | ||||||
---|---|---|---|---|---|---|
| ||||||
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 | ||||||
---|---|---|---|---|---|---|
| ||||||
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
Links
Display content by label | ||||
---|---|---|---|---|
|
Overview
Content Tools