JohnDanter2
VIP Member
Hi folks
I wish to add 2 output variables scsSuccess and scsFail to my orchestration.
Now this is easy to do (even for me) in the manipluate output section it works great if the consumer was expecting JSON back, but in this case I want to see the 2 output as columns for use in Excel.
So I need to create a step with the 2 variables declared so they show up. (So I did that in a groovy step)
So this is my code in the manipulate outputs section
So if I make the groovy step and declare the 2 output variables, they show up fine, but...... how would I now add code here to do the same thing and map in a 1 or 0 if the reponse from the previous step contains errors
I know I need to map in the previous steps response (so thats raw output) then I need to check it and map the 2 variables. Seems easy but my groovy is pants
Thanks
John
I wish to add 2 output variables scsSuccess and scsFail to my orchestration.
Now this is easy to do (even for me) in the manipluate output section it works great if the consumer was expecting JSON back, but in this case I want to see the 2 output as columns for use in Excel.
So I need to create a step with the 2 variables declared so they show up. (So I did that in a groovy step)
So this is my code in the manipulate outputs section
Code:
import groovy.json.JsonSlurper;
import groovy.json.JsonBuilder;
import com.oracle.e1.common.OrchestrationAttributes;
String main(OrchestrationAttributes orchAttr, String input)
{
def jsonIn = new JsonSlurper().parseText(input);
// modify jsonIn;
//Default reponse to be OK
jsonIn.scsSuccess = "1"
jsonIn.scsFail='0'
//if error detected set success to 0 and error to 1
if (jsonIn.continuedOnError!=null) {
//set the control variable scsResult to be in error state
jsonIn.scsSuccess = "0"
jsonIn.scsFail='1'
}
def jsonOut = new JsonBuilder(jsonIn).toString();
// orchAttr.writeWarn("custom log entry - warning");
// orchAttr.writeDebug("custom log entry - debug");
return jsonOut;
}
So if I make the groovy step and declare the 2 output variables, they show up fine, but...... how would I now add code here to do the same thing and map in a 1 or 0 if the reponse from the previous step contains errors
I know I need to map in the previous steps response (so thats raw output) then I need to check it and map the 2 variables. Seems easy but my groovy is pants
Thanks
John
Last edited: