khaleesi
Member
Hi there,
I am a form request which runs in a loop over multiple orchestration inputs. The orchestration inputs are in array format which requires end users to add input one by one in columnar format.
However if users have more than 10 inputs, its a hassle for them to add those many lines.
So, to resolve this, I created a groovy script which takes input in form of space separated string and pass it as dataset to the form request.
My groovy script is like below
import com.oracle.e1.common.OrchestrationAttributes;
import java.text.SimpleDateFormat;
import groovy.json.JsonSlurper;
import groovy.json.JsonBuilder;
HashMap<String, Object> main(OrchestrationAttributes orchAttr, HashMap inputMap)
{
HashMap<String, Object> returnMap = new HashMap<String, Object>();
// Add logic here
String stringVal = (String)inputMap.get("myString")
values = stringVal.split(' ')
def dataset =[]
// Loop through each value and add it to the dataset
values.each { value ->
// Add an object with a single field "value" to the dataset
dataset << [Shipment: value]
}
def ShipmentsDataset = JsonOutput.toJson(dataset)
returnMap.put(ShipmentsDataset)
return returnMap
}
It gives exception error "Exception groovy.lang.MissingPropertyException: No such property: JsonOutput for class: Script102".
Any help in resolving this error is greatly appreciated.
Thanks,
Gauri.
Release 23
I am a form request which runs in a loop over multiple orchestration inputs. The orchestration inputs are in array format which requires end users to add input one by one in columnar format.
However if users have more than 10 inputs, its a hassle for them to add those many lines.
So, to resolve this, I created a groovy script which takes input in form of space separated string and pass it as dataset to the form request.
My groovy script is like below
import com.oracle.e1.common.OrchestrationAttributes;
import java.text.SimpleDateFormat;
import groovy.json.JsonSlurper;
import groovy.json.JsonBuilder;
HashMap<String, Object> main(OrchestrationAttributes orchAttr, HashMap inputMap)
{
HashMap<String, Object> returnMap = new HashMap<String, Object>();
// Add logic here
String stringVal = (String)inputMap.get("myString")
values = stringVal.split(' ')
def dataset =[]
// Loop through each value and add it to the dataset
values.each { value ->
// Add an object with a single field "value" to the dataset
dataset << [Shipment: value]
}
def ShipmentsDataset = JsonOutput.toJson(dataset)
returnMap.put(ShipmentsDataset)
return returnMap
}
It gives exception error "Exception groovy.lang.MissingPropertyException: No such property: JsonOutput for class: Script102".
Any help in resolving this error is greatly appreciated.
Thanks,
Gauri.
Release 23