10-18-2016 06:30 AM
I can't understand why but the assignment doesn't work and the customized form for psw:activitiCreaCS hasn't the fields pswSGAincaricato and pswSincaricato
In my bpmn file I have an user task event where I need two select two assignees for other user tasks, like this:
<userTask id="creaCS" name="Crea Certificato di Servizio" activiti:candidateGroups="DSGA" activiti:formKey="psw:activitiCreaCS">
<extensionElements>
<activiti:taskListener event="complete" class="org.alfresco.repo.workflow.activiti.tasklistener.ScriptTaskListener">
<activiti:field name="script">
<activiti:string><![CDATA[logger.log("Log Log");
execution.setVariable('DSGAincaricato', task.getVariable('psw_DSGAincaricato'));
execution.setVariable('DSincaricato', task.getVariable('psw_DSincaricato'));]]>
</activiti:string>
</activiti:field>
</activiti:taskListener>
</extensionElements>
</userTask>
<userTask id="valutaCS" name="Valuta Certificato di Servizio" activiti:assignee="${DSincaricato.properties.userName}" activiti:formKey="psw:activitiValutaCS">
<extensionElements>
<activiti:taskListener event="complete" class="org.alfresco.repo.workflow.activiti.tasklistener.ScriptTaskListener">
<activiti:field name="script">
<activiti:string>if(task.getVariableLocal('psw_esitoValutazioneCS') == 'Approvato'){
execution.setVariable('psw_prosegui', true);
}else{
execution.setVariable('psw_prosegui', false);
}
</activiti:string>
</activiti:field>
</activiti:taskListener>
</extensionElements>
</userTask>
Following a tutorial I wrote a model:
<type name="psw:activitiCreaCS">
<parent>bpm:startTask</parent>
<associations>
<association name="pswSGAincaricato">
<title>DSGA incaricato</title>
<source>
<mandatory>false</mandatory>
<many>false</many>
</source>
<target>
<class>cmerson</class>
<mandatory>false</mandatory>
<many>false</many>
</target>
</association>
<association name="pswSincaricato">
<title>DS incaricato</title>
<source>
<mandatory>false</mandatory>
<many>false</many>
</source>
<target>
<class>cmerson</class>
<mandatory>false</mandatory>
<many>false</many>
</target>
</association>
</associations>
</type>
<type name="psw:activitiValutaCS">
<parent>bpm:activitiOutcomeTask</parent>
<properties>
<property name="psw:esitoValutazioneCS">
<type>d:text</type>
<default>Respinto</default>
<constraints>
<constraint type="LIST">
<parameter name="allowedValues">
<list>
<value>Approvato</value>
<value>Respinto</value>
</list>
</parameter>
</constraint>
</constraints>
</property>
</properties>
<overrides>
<property name="bpmackageItemActionGroup">
<default>edit_package_item_actions</default>
</property>
<property name="bpmutcomePropertyName">
<default>{http://www.portaleScuola.com/model/workflow/1.0}esitoValutazioneCS</default>
</property>
</overrides>
</type>
And a share-config-custom.xml like this
<config evaluator="task-type" condition="psw:activitiCreaCS">
<forms>
<form id="workflow-details">
<field-visibility>
<show id="bpm:workflowDescription"/>
<show id="packageItems"/>
<show id="pswSGAincaricato"/>
<show id="pswSincaricato"/>
<show id="transitions"/>
<show id="bpm:status"/>
</field-visibility>
<appearance>
<set id="" appearance="title" label-id="workflow.set.general" />
<set id="items" appearance="title" label-id="workflow.set.items" />
<set id="progress" appearance="title" label-id="workflow.set.task.progress" />
<set id="other" appearance="title" label-id="workflow.set.other" />
<field id="bpm:workflowDescription" label-id="workflow.field.message">
<control template="/org/alfresco/components/form/controls/textarea.ftl">
<control-param name="style">width: 95%</control-param>
</control>
</field>
<field id="packageItems" set="items" />
<field set="actors" id="pswSGAincaricato">
<control template="/org/alfresco/components/form/controls/authority.ftl">
</control>
</field>
<field set="actors" id="pswSincaricato">
<control template="/org/alfresco/components/form/controls/authority.ftl">
</control>
</field>
<field id="bpm:status" set="progress" />
</appearance>
</form>
<form>
<field-visibility>
<show id="bpm:workflowDescription"/>
<show id="packageItems"/>
<show id="pswSGAincaricato"/>
<show id="pswSincaricato"/>
<show id="transitions"/>
<show id="bpm:status"/>
</field-visibility>
<appearance>
<set id="" appearance="title" label-id="workflow.set.general" />
<set id="items" appearance="title" label-id="workflow.set.items" />
<set id="progress" appearance="title" label-id="workflow.set.task.progress" />
<set id="other" appearance="title" label-id="workflow.set.other" />
<field id="bpm:workflowDescription" label-id="workflow.field.message">
<control template="/org/alfresco/components/form/controls/textarea.ftl">
<control-param name="style">width: 95%</control-param>
</control>
</field>
<field id="packageItems" set="items" />
<field set="actors" id="pswSGAincaricato">
<control template="/org/alfresco/components/form/controls/authority.ftl">
</control>
</field>
<field set="actors" id="pswSincaricato">
<control template="/org/alfresco/components/form/controls/authority.ftl">
</control>
</field>
<field id="bpm:status" set="progress" />
</appearance>
</form>
</forms>
</config>
10-20-2016 10:51 AM
10-20-2016 10:53 AM
Cross posted here: forms - How to select a task assignee in Alfresco from a previous user task? - Stack Overflow
Please don't do that.
10-20-2016 10:56 AM
Ok, I'm sorry but I was a little desperate
10-20-2016 11:51 AM
No worries, I understand. Let's keep troubleshooting on SO.
I'd like to see all of your files so that I can deploy locally and try to recreate this on my machine. The easiest thing would be if you had an AMP I could deploy. I can also build my own AMP from source.
10-20-2016 01:40 PM
10-20-2016 03:28 PM
Cool, thanks, installing now.
10-20-2016 03:58 PM
Okay, the first problem was that in the AMP you sent, the workflow uses candidate groups set to "DSGA" when it should be "GROUP_DSGA". This was preventing the first task from being assigned to my test user. O I changed to GROUP_DSGA and reployed, then started a new workflow.
Next, when I started the workflow, the task got assigned to me, but the form didn't have your custom properties. I went into the workflow console and did a "show task" and noticed that the name is "psw:activitiCreaCS".
However, when I looked at the share-config-custom.xml that is inside your JAR it does not contain a config for that type. The file you uploaded earlier does. So I think the problem is that your JAR is not being updated with the latest and greatest copy of the share-config-custom.xml file. Either that or you sent me an old JAR.
You should do a jar xvf $TOMCAT_HOME/webapps/share/WEB-INF/lib/workflow-portalescuola-share-1.0-SNAPSHOT.jar META-INF/share-config-custom.xml and confirm that is the latest version of that file, and if it is, see if contains a form config for "psw:activitiCreaCS".
10-21-2016 04:38 AM
Ok, I changed the candidate groups to GROUP_DSGA.
Then I checked like you said:
host-131-114-104-196:~ mafaldapapini$ jar xvf $TOMCAT_HOME/webapps/share/WEB-INF/lib/workflow-portalescuola-share-1.0-SNAPSHOT.jar META-INF/share-config-custom.xml
java.io.FileNotFoundException: /webapps/share/WEB-INF/lib/workflow-portalescuola-share-1.0-SNAPSHOT.jar (No such file or directory)
at java.util.zip.ZipFile.open(Native Method)
at java.util.zip.ZipFile.<init>(ZipFile.java:220)
at java.util.zip.ZipFile.<init>(ZipFile.java:150)
at java.util.zip.ZipFile.<init>(ZipFile.java:121)
at sun.tools.jar.Main.extract(Main.java:956)
at sun.tools.jar.Main.run(Main.java:303)
at sun.tools.jar.Main.main(Main.java:1233)
I looked for the file workflow-portalescuola-share-1.0-SNAPSHOT.jar and I found two. The first one is in /Users/mafaldapapini/Desktop/PORTALE-SCUOLA/workflow-portalescuola-share/target/amp/lib, so I run:
host-131-114-104-196:~ mafaldapapini$ jar xvf /Users/mafaldapapini/Desktop/PORTALE-SCUOLA/workflow-portalescuola-share/target/amp/lib/workflow-portalescuola-share-1.0-SNAPSHOT.jar META-INF/share-config-custom.xml
decompresso: META-INF/share-config-custom.xml
decompresso: META-INF/share-config-custom.xml.sample
The other one is in /Users/mafaldapapini/Desktop/PORTALE-SCUOLA/workflow-portalescuola-share/target/amp-war/WEB-INF/lib:
host-131-114-104-196:~ mafaldapapini$ jar xvf /Users/mafaldapapini/Desktop/PORTALE-SCUOLA/workflow-portalescuola-share/target/amp-war/WEB-INF/lib/workflow-portalescuola-share-1.0-SNAPSHOT.jar META-INF/share-config-custom.xml
decompresso: META-INF/share-config-custom.xml
decompresso: META-INF/share-config-custom.xml.sample
The share-config-custom.xml in /Users/mafaldapapini/Desktop/PORTALE-SCUOLA/workflow-portalescuola-share/src/main/resources/META-INF has a config for "psw:activitiCreaCS":
<config evaluator="task-type" condition="psw:activitiCreaCS">
<forms>
<form id="workflow-details">
<field-visibility>
<show id="bpm:workflowDescription"/>
<show id="packageItems"/>
<show id="psw:DSGAincaricato"/>
<show id="psw:DSincaricato"/>
<show id="transitions"/>
<show id="bpm:status"/>
</field-visibility>
<appearance>
<set id="" appearance="title" label-id="workflow.set.general" />
<set id="items" appearance="title" label-id="workflow.set.items" />
<set id="progress" appearance="title" label-id="workflow.set.task.progress" />
<set id="other" appearance="title" label-id="workflow.set.other" />
<field id="bpm:workflowDescription" label-id="workflow.field.message">
<control template="/org/alfresco/components/form/controls/textarea.ftl">
<control-param name="style">width: 95%</control-param>
</control>
</field>
<field id="packageItems" set="items" />
<field set="actors" id="psw:DSGAincaricato"/>
<field set="actors" id="psw:DSincaricato"/>
<field id="bpm:status" set="progress" />
</appearance>
</form>
<form>
<field-visibility>
<show id="bpm:workflowDescription"/>
<show id="packageItems"/>
<show id="psw:DSGAincaricato"/>
<show id="psw:DSincaricato"/>
<show id="transitions"/>
<show id="bpm:status"/>
</field-visibility>
<appearance>
<set id="" appearance="title" label-id="workflow.set.general" />
<set id="items" appearance="title" label-id="workflow.set.items" />
<set id="progress" appearance="title" label-id="workflow.set.task.progress" />
<set id="other" appearance="title" label-id="workflow.set.other" />
<field id="bpm:workflowDescription" label-id="workflow.field.message">
<control template="/org/alfresco/components/form/controls/textarea.ftl">
<control-param name="style">width: 95%</control-param>
</control>
</field>
<field id="packageItems" set="items" />
<field set="actors" id="psw:DSGAincaricato"/>
<field set="actors" id="psw:DSincaricato"/>
<field id="bpm:status" set="progress" />
</appearance>
</form>
</forms>
</config>
10-21-2016 11:44 AM
You are showing the content from your source file (/Users/mafaldapapini/Desktop/PORTALE-SCUOLA/workflow-portalescuola-share/src/main/resources/META-INF).
I am suggesting that whatever you are running for your test does not include that source file. The AMP that you sent me is evidence of that.
How are you packaging your source? Are you using Maven?
How are you deploying your AMP and running the test? Are you using mvn integration-test -Pamp-to-war or something else?
Tags
Find what you came for
We want to make your experience in Hyland Connect as valuable as possible, so we put together some helpful links.