Subprocess & BDM
I've found no example of subprocesses that share BDM objects with the main calling process.
I've tried to define a subprocess with a BDM and a contract of the same type that the business object that should be shared from the calling process, but I've an exception at runtime. Here is the log :
org.bonitasoft.engine.core.process.instance.api.exceptions.SContractViolationException: Error while validating expected inputs: [fr.fv.WorkData@3a48f4c8 cannot be assigned to COMPLEX type]
In the main process I set a BDM object : mainWorkData
In the subprocess I've a contract for initialization : subWorkDataInput
In the subprocess, the BDM is : subWorkData, and the initialization script is just a return of the subWorkDataInput, since the reference that is given by the main process by the contract should be used as is to set the subprocess business data.
Any example, idea or help about such cases ?
I have the same issue. I have an iterator on the main process that maps a contract on subprocess. The error is:
Error while validating expected inputs: [ec.gob.xxx.xxx.xxx.BOType003@fa6a5091 cannot be assigned to COMPLEX type]"
Could you solve this?
Thanks in advance.
Hope this helps someone!
I was able to solve this by creating a variable(local or process works well) of type org.json.simple.JSONObject and then initialize/set the value with all the field names as key and values based on the parent process in the contract required to instantiate the sub process, like below
def ob = new org.json.simple.JSONObject();
ob.put("name", "Raji Malla");
ob.put("details", "sample details");
I mapped this variable to the contract input name specified in the sub process under 'Assigned to Contract input' type and then it worked.