on 07-23-2015 8:30 PM
Hi All,
Can anyone please help me how to pass parameter in a Redwood script.
For example:
jobdefparam.setDefaultExpression("BTCHWM");
How can I pass "BTCHWM" as a parameter.
Also please help me how to pass a chain level parameter in "post running action" of a script.
Regards,
Lohit
Hello,
Define a parameter on the RedwoodScript job definition in the parameters tab, for instance call it defaultValue.
Now in your code you can just refer to it:
jobdefparam.setDefaultExpression(defaultValue);
To fetch a chain parameter in a postrunning action you need to look up the chain from jcsJob (the 'current' job) using something like:
Job chain = jcsJob.getParentJob().getParentJob(); // first the step, then the chain
String parameterValue = chain.getJobParameterByName("parameter name").getInValueString();
Regards Gerben
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Thank you very much Gerben.
As you said, I tried to refer the Chain level parameter using the below script
Job jc = jcsJob.getParentJob().getParentJob();
String jcparam = jc.getJobParameterByName("JOBCHAINNAME").getInValueString();
JobDefinition aJobDef = jcsSession.getJobDefinitionByName(jcparam);
Job aJob = aJobDef.prepare();
I am getting the below error. Please advise.
Caused by: java.lang.NullPointerException: while trying to invoke the method com.redwood.scheduler.api.model.Job.getParentJob() of a null object returned from com.redwood.scheduler.api.model.Job.getParentJob()
at com.redwood.scheduler.custom.CS_I73_IN_OBEXT_CHECK_FILE_EXIST_AGAIN_09execute(CS_I73_IN_OBEXT_CHECK_FILE_EXIST_AGAIN_09.java:user code 45)
at com.redwood.scheduler.custom.CS_I73_IN_OBEXT_CHECK_FILE_EXIST_AGAIN_09Stub.jcsExecute(CS_I73_IN_OBEXT_CHECK_FILE_EXIST_AGAIN_09Stub.java:24)
... 19 more
Regards,
Lohit
User | Count |
---|---|
98 | |
11 | |
11 | |
10 | |
10 | |
8 | |
6 | |
5 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.