Versions Compared

Key

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

...

Code Block
languagejs
titleExample for implementation of js7JobArgument with JavaScript
linenumberstrue
class JobArguments {
    // arguments with string data type
	colorBlue = new js7.JobArgument('color_blue', true, 'blue');
	colorRed = new js7.JobArgument('color_red', true, 'red');
	colorOrange = new js7.JobArgument('color_orange', true, 'orange');
  
    // arguments with numeric data type
    numOfDays = new js7.JobArgument('num_of_days', true, 5);

    // arguments with Boolean data type
    isEndOfMonth = new js7.JobArgument('is_end_of_month', true, true);

    // arguments with masked output that prevents value from being logged
    password = new js7.JobArgument('password', true, 'secret', js7.DisplayMode.MASKED);
}

class JS7Job extends js7.Job {
	declaredArguments = new JobArguments();

	processOrder(js7Step) {
        // get list of all declared arguments
		var allArgs = js7Step.getAllDeclaredArguments();
		js7Step.getLogger().info('[getAllDeclaredArguments]:');
		js7Step.getLogger().info('all declared arguments: ' + allArgs);

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

...