Hi All,
We are facing the run-time issue while using The Engine API in common groovy script (Development–>Manage Groovy script–>(Create new groovy Script))
Run-time Issue:
groovy.lang.MissingPropertyException: No such property: apiAccessor for class: CommonScriptTest
Common Groovy Script Code:
import groovy.json.*;
import org.bonitasoft.engine.api.ProcessAPI;
import org.bonitasoft.engine.api.ProcessRuntimeAPI;
import org.bonitasoft.engine.api.APIAccessor;
import java.util.logging.Logger;
import java.util.logging.Level;
def setValueToProcessVariable(def connResult,long processInstanceId) {
Logger log = Logger.getLogger(getClass().getName());
log.setLevel(Level.findLevel(“INFO”));
def slurper = new JsonSlurper();
def parseResult = slurper.parseText(connResult);
log.info(“setValueToProcessVariable -------------> start ::” +processInstanceId);
Map<Object,Object> map=new HashMap<Object,Object>();
if(parseResult!=null){
String cusID=parseResult.customerID;
log.info("customer ID : "+cusID);
custID = Integer.parseInt(cusID);
custName = parseResult.c_name;
log.info("custName : "+custName);
custAddress = parseResult.c_address;
log.info("custAddress : "+custAddress);
custZip =parseResult.zipCode;
log.info("custZip : "+custZip);
map.put(“cus_ID” , custID);
map.put(“cus_Name”, custName);
map.put(“cus_Address”, custAddress);
map.put(“cus_Zip”, custZip);
apiAccessor.getProcessAPI().updateProcessDataInstances(processInstanceId, map);
log.info(“setValueToProcessVariable -------------> end”);
} }
Log Files:
groovy.lang.MissingPropertyException: No such property: apiAccessor for class: CommonScriptTest
at org.codehaus.groovy.runtime.ScriptBytecodeAdapter.unwrap(ScriptBytecodeAdapter.java:53)
at org.codehaus.groovy.runtime.callsite.PogoGetPropertySite.getProperty(PogoGetPropertySite.java:52)
at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callGroovyObjectGetProperty(AbstractCallSite.java:307)
at CommonScriptTest.setValueToProcessVariable(CommonScriptTest.groovy:37)
at CommonScriptTest$setValueToProcessVariable.call(Unknown Source)
at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:48)
at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:113)
at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:133)
at BScript2.run(BScript2.groovy:31)
Kindly help me to provide a way to achieve. Deeply looking for your valuable response.
Thanks,
Rajiv M