06-15-2021 08:37 PM
I have a workflow that has a user task, that takes in a text field, and I want to print it to the logs. I have a form key and model that look like this:
activiti:formKey="someco:getMessageTask" <type name="someco:getMessageTask"> <parent>bpm:workflowTask</parent> <properties> <property name="someco:message"> <type>d:text</type> <mandatory>true</mandatory> <multiple>false</multiple> </property> </properties> </type>
I have have a then a sequence flow to the end event, and all it does is write to the log. It looks like this
<sequenceFlow id="SequenceFlow_2" sourceRef="EnterMessageTask" targetRef="EndEvent_1"> <extensionElements> <activiti:executionListener xsi:type="xsd:anyType" event="start" class="org.alfresco.repo.workflow.activiti.listener.ScriptExecutionListener"> <activiti:field xsi:type="xsd:anyType" name="script"> <activiti:string xsi:type="xsd:anyType"><![CDATA[logger.log("Hello, " + someco_message + "!");]]></activiti:string> </activiti:field> </activiti:executionListener> </extensionElements> </sequenceFlow>
When I try and start the workflow, I get an error message: (As a site note, I get this error as soon as I start, it's like alfresco compiles the script before running, which to me, it the exact opposite of what a "script" is)
"someco_message" is not defined. (AlfrescoJS#1)
Now when I start the workflow with that variable (in the admin console, "start someco_message=AMessage" it works fine.
But why? I defined that variable in the model for the previous task. If that's not the way to do it (And im pretty sure it's not) What is the point of a task model? Is there a good tutorial/explanation on how to handle data in a workflow?
06-16-2021 10:51 AM
The problem, as fas as I understand, is this:
<mandatory>true</mandatory>
If you have that property declared as mandatory, in order to launch the workflow that property should have content. For that reason is you launch from admin console, "start someco_message=AMessage" it's working... because you are full fill in.
Check this guide made by @jpotts you have a really nice examples where you can start to learn how to make them properly.
Cheers.
Explore our Alfresco products with the links below. Use labels to filter content by product module.