Well, I made it WORK!!!!! Thanks for the inspiration Dave!
The form request transformation tab has to be set to "return raw output". Doing this allows you to set that output as an input to a custom groovy script. The groovy script is not set to "return raw output" or you will end with the json having extra escape characters.
Again, I do appreciate all of the posts on this forum, they were infinitely helpful , so I feel inclined to pay it back. Here is the groovy. Keep those custom groovy code snippets coming, it's our only way to survive, oracle help is less than helpful. In the end, it was quite simple. Trying to figure out what it wants me to do was the toughest thing about it.
Hopefully this post will help someone minimize the number of ORCH objects necessary to operate. A note about my use case.... In my example, I am extracting customer data and sometimes the end use of the API requires more columns or less columns, it just depends. Now, I can support one API and the code handles both situations.
import groovy.json.JsonSlurper;
import groovy.json.JsonBuilder;
import com.oracle.e1.common.OrchestrationAttributes;
import java.text.SimpleDateFormat;
HashMap<String, Object> main(OrchestrationAttributes orchAttr, HashMap inputMap)
{
HashMap<String, Object> returnMap = new HashMap<String, Object>();
// Add logic here
// String stringVal = (String)inputMap.get("inputStringVal");
// BigDecimal numVal = new BigDecimal((String)inputMap.get("inputNumVal"));
// SimpleDateFormat format = new SimpleDateFormat(orchAttr.getSimpleDateFormat());
// Date dateVal = format.parse((String)inputMap.get("inputDateVal"));
// orchAttr.writeWarn("custom log entry - warning");
// orchAttr.writeDebug("custom log entry - debug");
// def array = '[{"Column1":"val1","Column2":"val2"},{"Column1":"val3","Column2":"val4"}]';
// returnMap.put("Output Array", array);
// returnMap.put("Output String", stringVal);
String integrationType = (String)inputMap.get("in_IntegrationType_55IT");
if (integrationType=='Type1') {
def jsonType1 = new JsonSlurper().parseText(inputMap.get("in_jsonType1"))
def jsonOut = new JsonBuilder(jsonType1).toString()
returnMap.put("Customers", jsonOut)
}
if (integrationType=='Type2') {
def jsonType2 = new JsonSlurper().parseText(inputMap.get("in_jsonType2"))
def jsonOut = new JsonBuilder(jsonType2).toString()
returnMap.put("Customers", jsonOut)
}
return returnMap;
}