AEM workflow to invoke Livecycle process
Hi All
I have written ECMA script and the same is called by a process task inside AEM WF to call LC process. For some reason, the error.log says that it has got internal error while invoking my LC process.
Intention of my ECMA script is to obtain the incoming guideBridge XML from the form and post it to LC process. My submit button from my AEM form is configured to store the data in local JCR repoisitory.
On other note, I have configured my submit button directly to forms workflow and AEM is able to invoke the same LC process that I am trying to invoke from ECM. Please advise, if I am missing something from my ECMA script. Thanks!
Below is the code from ECMA:
log.error("#### Inside biztech LC process initiator #####");
var docBuilder = sling.getService(Packages.javax.xml.parsers.DocumentBuilder);
var docBuilderFactory = sling.getService(Packages.javax.xml.parsers.DocumentBuilderFactory);
var xmlDocument = sling.getService(Packages.org.w3c.dom.Document);
var paramsMap = Packages.java.util.Map;
var paramsHashMap = new Packages.java.util.HashMap();
var processName = "biztech/process/newContractSubmissionHandler";
var workflowData = workItem.getWorkflowData();
var session = workflowSession.getSession();
var path = workflowData.getPayload().toString();
log.error("The incoming payload is ::"+ path);
var node = workflowSession.getSession().getItem(path);
//var userdataID = node.getProperty("userdataID").getString();
//log.info("### the node name is..."+node.getName())
var rootNode = session.getRootNode();
//var dataNode = rootNode.getNode(userdataID.substring(1));
var is = node.getProperty("jcr:data").getBinary().getStream();
var factory = Packages.javax.xml.parsers.DocumentBuilderFactory.newInstance();
var scfProvider = sling.getService(Packages.com.adobe.livecycle.dsc.clientsdk.ServiceClientFactoryProvider);
var scf = scfProvider.getDefaultServiceClientFactory();
var builder = factory.newDocumentBuilder();
var xmlData = builder.parse(is);
log.info("the first child name is..."+xmlData.getFirstChild().getNodeName());
log.info("Got input stream...");
paramsHashMap.put("formData",xmlData);
//paramsHashMap.put("nodeName",path);
var ir = scf.createInvocationRequest("biztech/process/newContractSubmissionHandler","invoke",paramsHashMap,true);
ir.setProperty(Packages.com.adobe.livecycle.dsc.clientsdk.InvocationProperties.INVOKER_TYPE,Packages.com.adobe.livecycle.dsc.clientsdk.InvocationProperties.INVOKER_TYPE_SYSTEM);
scf.getServiceClient().invoke(ir);
log.info("#### invoked LC Process "+processName);
Below is the error snippet.
See attachment.