Versions Compared

Key

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

...

ObjectPurpose
js7StepThe built-in object js7Step provides a number of methods
AreaMethodArgumentReturn Value
ArgumentgetAllArguments()n/a[object[]] arguments

getAllArgumentsAsNameValueMap()n/a[map] argumentMap

getAllDeclaredArguments()n/a[object[]] arguments

getDeclaredArgument()[string] argumentName[object] argument

getDeclaredArgumentValue()[string] argumentName[string|int|bool] argumentValue

getJobResourcesArgumentsAsNameDetailValueMap()n/a[map] arguments

getOrderArgumentsAsNameValueMap()n/a[map] arguments
JobgetAgentIdt()n/a[string] agentId

getJobEnvironment()n/a[object] jobEnvironment

getJobEnvironment().getJobKey()n/a

getJobEnvironment().getEncoding()n/a[string] encoding

getJobEnvironment()..getDeclaredArguments()n/a[object[]] jobArguments

getJobInstructionLabel()n/a[string] label

getJobName()n/a[string] jobName

getControllerId()n/a[string] controllerId

getOrderId()n/a[string] orderId

getWorkflowName()n/a[string] workflowName

getWorkflowPosition()n/a[string] position

getWorkflowVersionId()n/a[string] versionId
OutcomegetLastFailedOutcomes()n/a[object[]] outcomes

getLastSucceededOutcomes()n/a[object[]] outcomes

getOutcome()n/a

[object] outcome


getOutcome().putVariable()[string] name,
[string|int|bool] value
n/a
UtilitygetLogger()[string] messagen/a

Example: Access Arguments

Code Block
languagejs
titleExample for implementation of js7Job with JavaScript
linenumberstrue
class JS7Job extends js7.Job {

	processOrder(js7Step) {
		js7Step.getLogger().info("Hello World" js7Step.getAllArgumentsAsNameValueMap['js7Workflow.path'] );
    }
}

Explanations:

  • The implementation class with the name JS7Job is required.
  • The processOrder() method is required to be implemented by the job.
    • The method is parameterized by the js7Step object.
    • The js7Step object is used with its getLogger() method to create some write output to the job's log.
    • The getAllArgumentsAsNameValueMap() method provides a map of all arguments. The map allows to read a single argument from the argument name.

Example: List Arguments

Code Block
languagejs
titleExample for implementation of js7Job with JavaScript
linenumberstrue
class JS7Job extends js7.Job {

	processOrder(js7Step) {
		var allArgs = js7Step.getAllArguments();
        for (var arg in allArgs) {
			js7Step.getLogger().info('argument: ' + arg + '=' + allArgs[arg]);
		}
    }
}

Class js7.JobArgument

The js7.JobArgument class can optionally be used to access declared variables.

...

  • The example declares a number of arguments with default values in different data types.
  • The getAllDeclaredArguments() method returns the list of arguments that can be iterated.

...