Your achievements

Level 1

0% to

Level 2

Tip /
Sign in

Sign in to Community

to gain points, level up, and earn exciting badges like the new
Bedrock Mission!

Learn more

View all

Sign in to view all badges

SOLVED

AEM workflow to invoke Livecycle process

vkeerthy
Level 3
Level 3

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.

1 Accepted Solution
smacdonald2008
Correct answer by
Level 10
Level 10

To call a LC process from AEM - use a custom JAVA Step within AEM and in that step - invoke the LC process using the LC Process API.

See here: 

http://help.adobe.com/en_US/livecycle/11.0/ProgramLC/WS624e3cba99b79e12e69a9941333732bac8-7d9a.2.htm...

So you can invoke a short-lived process using this example. 

Here is an example of calling LiveCycle Output service from an AEM custom service:

https://helpx.adobe.com/experience-manager/using/integrating-livecycle-cq-applications.html

View solution in original post

2 Replies
smacdonald2008
Correct answer by
Level 10
Level 10

To call a LC process from AEM - use a custom JAVA Step within AEM and in that step - invoke the LC process using the LC Process API.

See here: 

http://help.adobe.com/en_US/livecycle/11.0/ProgramLC/WS624e3cba99b79e12e69a9941333732bac8-7d9a.2.htm...

So you can invoke a short-lived process using this example. 

Here is an example of calling LiveCycle Output service from an AEM custom service:

https://helpx.adobe.com/experience-manager/using/integrating-livecycle-cq-applications.html

View solution in original post

vkeerthy
Level 3
Level 3

Thanks! Wouldn't that be possible to write simple ECMA to trigger short lived process. Is ECMA not supported from AEM adaptive forms workflow to invoke LC?