Hi all,
I want to add some custom properties to workflow instances of a custom activiti wf. These custom properties shoud be used by task queries in custom web scripts.
Question 1: how to add properties to workflow instances ? (not to tasks) Using wf start task ?
Question 2: where to find example on how to use setProcessCustomProps method of WorkflowTaskQuery class ?
Thanks,
Vincent
1) Yes, using the workflow start task would be the default way of adding these properties to the process instances. At runtime (inside an Activiti task / execution listener) you can also use the execution object to set variables - be aware though that there is a multi-level, inheritance-based isolation model for variables and as soon as a variable is set i.e. within the context of a process branch, it will be hard(er) to update the same-name variable on the global process instance scope.
2) What kind of example do you need? It is a simple setter which takes a map of properties, so any example should be as simple as:
Map<QName, Serializable> processProps = new HashMap<>();
processProps.put(WorkflowModel.PROP_SEND_EMAIL_NOTIFICATIONS, Boolean.TRUE);
// ...
taskQuery.setProcessCustomProps(processProps);
Thanks for your response.
Maybe I misunderstood something, but I can't find any way to read properties from a workflow instance in JAVA.
When adding custom properties at workflow startup using workflow start task, how to read these properties afterwards ? I can of course get the start task from workflow instance and read its properties like below, but I'm not sure it's the proper way to proceed....
<code>
WorkflowTask startTask = workflowService.getStartTask(workflowInstance.getId());
Map<QName, Serializable> processProps = startTask.getProperties()
.....
<code/>
ps: stupid question: I can't find how to format code properly in this forum ?
Ask for and offer help to other Alfresco Content Services Users and members of the Alfresco team.
Related links:
By using this site, you are agreeing to allow us to collect and use cookies as outlined in Alfresco’s Cookie Statement and Terms of Use (and you have a legitimate interest in Alfresco and our products, authorizing us to contact you in such methods). If you are not ok with these terms, please do not use this website.