cancel
Showing results for 
Search instead for 
Did you mean: 

How can I choose the assignee in a previous form?

mafaldap
Star Contributor
Star Contributor

I can't understand why but the assignment doesn't work and the customized form for psw:activitiCreaCS hasn't the fields pswSmiley Very HappySGAincaricato and pswSmiley Very HappySincaricato

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="pswSmiley Very HappySGAincaricato">

  <title>DSGA incaricato</title>

  <source>

  <mandatory>false</mandatory>

  <many>false</many>

  </source>

  <target>

  <class>cmSmiley Tongueerson</class>

  <mandatory>false</mandatory>

  <many>false</many>

  </target>

  </association>

  <association name="pswSmiley Very HappySincaricato">

  <title>DS incaricato</title>

  <source>

  <mandatory>false</mandatory>

  <many>false</many>

  </source>

  <target>

  <class>cmSmiley Tongueerson</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="bpmSmiley TongueackageItemActionGroup">

  <default>edit_package_item_actions</default>

  </property>

  <property name="bpmSmiley SurprisedutcomePropertyName">

  <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="pswSmiley Very HappySGAincaricato"/>

  <show id="pswSmiley Very HappySincaricato"/>

  <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="pswSmiley Very HappySGAincaricato">

               <control template="/org/alfresco/components/form/controls/authority.ftl">

              

               </control>

               </field>

               <field set="actors" id="pswSmiley Very HappySincaricato">

               <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="pswSmiley Very HappySGAincaricato"/>

  <show id="pswSmiley Very HappySincaricato"/>

  <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="pswSmiley Very HappySGAincaricato">

               <control template="/org/alfresco/components/form/controls/authority.ftl">

              

               </control>

               </field>

               <field set="actors" id="pswSmiley Very HappySincaricato">

               <control template="/org/alfresco/components/form/controls/authority.ftl">

              

               </control>

               </field>

               <field id="bpm:status" set="progress" />

  </appearance>

  </form>

  </forms>

</config>

11 REPLIES 11

mafaldap
Star Contributor
Star Contributor

Here all the files

mafaldap
Star Contributor
Star Contributor

Ok, I'm sorry but I was a little desperate

jpotts
World-Class Innovator
World-Class Innovator

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.

mafaldap
Star Contributor
Star Contributor

I think this should work, else I can send the other files

jpotts
World-Class Innovator
World-Class Innovator

Cool, thanks, installing now.

jpotts
World-Class Innovator
World-Class Innovator

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".

mafaldap
Star Contributor
Star Contributor

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>

jpotts
World-Class Innovator
World-Class Innovator

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?