AnsweredAssumed Answered

Does exist file in CMIS repository on workflow started by rule?

Question asked by pnature on Feb 6, 2017
Latest reply on Feb 16, 2017 by pnature

Hi,

I am new on Alfresco community version 5.2

I tried to access document from service task java class using CMIS API

Document is attached to workflow on start by rule java script as:

var workflow = actions.create("start-workflow");

workflow.parameters.docnode = document;

workflow.execute(document);

 

In service task java class I access document

ActivitiScriptNode scriptNode = (ActivitiScriptNode) execution.getVariable("docnode");

NodeRef docref = scriptNode.getNodeRef();

ClientCmis client = new ClientCmis();
Document doc = (Document) client.searchDocument(scriptNode.getId());

I still had got NullPointerException but when I substitute scriptNode.getId()with string ID of existing document code works fine.

It seems to me that file does not exist in CMIS repository until rule code reaches end. Does it have something to do with transactions?

Outcomes