02-26-2019 10:26 AM
Hi, I realized a workflow following the tutorial at ecmarchitect. I need to add the possibility to select the user who must approve the document, when the workflow is started.
I think I should modify both platform and share models but I can't understand what I should add, can you help me?
02-28-2019 09:17 PM
Hello,
In the platform side you need to extend the workflow content model to add a new association with a cm erson to store the approver.
erson to store the approver.
       <type name="scwf:submitReviewTask">
         <parent>bpm:startTask</parent>
            <associations>
                 <association name="scwf:approver">
                    <source>
                        <mandatory>false</mandatory>
                        <many>true</many>
                    </source>
                    <target>
                        <class>cm:person</class>
                        <mandatory>true</mandatory>
                        <many>false</many>
                    </target>
                </association>
            </associations>
			<mandatory-aspects>
				<aspect>scwf:thirdPartyReviewable</aspect>
			</mandatory-aspects>
		</type>and must change workflow definition asigning the user selected to the task you want:
activiti:assignee="${scwf_approver.properties.userName}"
In the share side you need to change the start form of workflow to show te selector of the user:
    <config evaluator="string-compare" condition="activiti$publishWhitepaper">
      <forms>
         <form>
            <field-visibility>
               <show id="bpm:workflowDescription" />
               <show id="packageItems" />
               <show id="scwf:reviewerEmail" />
               <show id="scwf:approver" />
               <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 id="scwf:reviewerEmail" set="other" />
               <field id="scwf:approver" mandatory="true" set="other" />
               <field id="bpm:status" set="progress" />
            </appearance>
         </form>
      </forms>
    </config>Regards
 Roberto Gámiz Sánchez
Alfresco Content Services Engineer
02-28-2019 09:17 PM
Hello,
In the platform side you need to extend the workflow content model to add a new association with a cm erson to store the approver.
erson to store the approver.
       <type name="scwf:submitReviewTask">
         <parent>bpm:startTask</parent>
            <associations>
                 <association name="scwf:approver">
                    <source>
                        <mandatory>false</mandatory>
                        <many>true</many>
                    </source>
                    <target>
                        <class>cm:person</class>
                        <mandatory>true</mandatory>
                        <many>false</many>
                    </target>
                </association>
            </associations>
			<mandatory-aspects>
				<aspect>scwf:thirdPartyReviewable</aspect>
			</mandatory-aspects>
		</type>and must change workflow definition asigning the user selected to the task you want:
activiti:assignee="${scwf_approver.properties.userName}"
In the share side you need to change the start form of workflow to show te selector of the user:
    <config evaluator="string-compare" condition="activiti$publishWhitepaper">
      <forms>
         <form>
            <field-visibility>
               <show id="bpm:workflowDescription" />
               <show id="packageItems" />
               <show id="scwf:reviewerEmail" />
               <show id="scwf:approver" />
               <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 id="scwf:reviewerEmail" set="other" />
               <field id="scwf:approver" mandatory="true" set="other" />
               <field id="bpm:status" set="progress" />
            </appearance>
         </form>
      </forms>
    </config>Regards
 Roberto Gámiz Sánchez
Alfresco Content Services Engineer
03-01-2019 03:17 AM
Thanks a lot, that works good. The user selection show all Alfresco users, is it possible to limit it to only a group?
03-01-2019 07:34 AM
You could develop a custom Form Control for the association:
Form Controls | Alfresco Documentation
Forms reference | Alfresco Documentation
Regards.
 Roberto Gámiz Sánchez
Alfresco Content Services Engineer
 
					
				
				
			
		
Explore our Alfresco products with the links below. Use labels to filter content by product module.