Alfresco: Show task fields in another task(view them)

半腔热情 提交于 2019-12-08 01:24:30

问题


I'm deploying new workflow to alfresco 4.0.e. I have a task with formkey="cwf:submitLeaveTask" here is the code:

    <type name="cwf:submitLeaveTask">
        <parent>bpm:startTask</parent>
        <properties>
            <property name="cwf:leaveDescription">
                <type>d:text</type>
            </property>
            <property name="cwf:duration">
                <type>d:int</type>
                <mandatory>true</mandatory>
            </property>
            <property name="cwf:startDate">
                <type>d:date</type>
                <mandatory>true</mandatory>
            </property>
            <property name="cwf:leaveType">
                <type>d:text</type>
                <mandatory>true</mandatory>
                <constraints>
                    <constraint name="cwf:leaveType" type="LIST">
                        <parameter name="allowedValues">
                            <list>
                                <value>paid leave</value>
                                <value>sick leave</value>
                            </list>
                        </parameter>
                    </constraint>
                </constraints>
            </property>
        </properties>
    </type>

This task connected to another task with formkey:"cwf:submitSubstitutinUSer"

    <type name="cwf:submitSubstitutingUser">
        <parent>bpm:activitiOutcomeTask</parent>
        <properties>
            <property name="cwf:substitutingDecisionForLeaveOutcome">
                <type>d:text</type>
                <default>Reject</default>
                <constraints>
                    <constraint name="cwf:substitutingDecisionForLeaveOutcomeOptions"
                        type="LIST">
                        <parameter name="allowedValues">
                            <list>
                                <value>Approve</value>
                                <value>Reject</value>
                            </list>
                        </parameter>
                    </constraint>
                </constraints>
            </property>
        </properties>
        <overrides>
            <property name="bpm:packageItemActionGroup">
                <default>edit_package_item_actions</default>
            </property>
            <property name="bpm:outcomePropertyName">
                <default>{custom.workflow.model}submitSubstitutingUserDecisionForLeaveOutcome
                </default>
            </property>
        </overrides>
    </type>

I need to show cwf:startDate and cwf:duration in my second task. I have this code in share-workflow-form-config.xml

<config evaluator="task-type" condition="cwf:submitSubstitutingUser">
    <forms>
        <form>
            <field-visibility>
                <show id="taskOwner" />
                <show id="cwf:startDate"  /> 
                <show id="cwf:duration" /> 
                <show id="cwf:substitutingDecisionForLeaveOutcome" />
            </field-visibility>
            <appearance>
                <set id="" appearance="title" label-id="workflow.set.task.info" />
                <set id="info" appearance="" template="/org/alfresco/components/form/3-column-set.ftl" />
                <set id="response" appearance="title" />

                <field id="taskOwner" set="info"></field>
                <field id="cwf:startDate" set="info"></field>
                <field id="cwf:duration" set="info"></field>
                <field id="cwf:substitutingDecisionForLeaveOutcome" label-id="workflow.field.outcome"
                    set="response">
                    <control
                        template="/org/alfresco/components/form/controls/workflow/activiti-transitions.ftl" />
                </field>

            </appearance>
        </form>
    </forms>

</config>

But I cant see cwf:startDate and cwf:duration in my form. What is wrong and how I should do it?


回答1:


You can't see those properties because you put them in the property xml field in the workflow model, appended to another task type (cwf:submitLeaveTask). You should use aspects instead of properties. Aspects in Alfresco are like objects that you can reuse in every type in that particular model, instead of properties that can only be bound to one type at once:

 <aspects>
  <aspect name="cwf:myAspect">
     <title>My Aspect</title>
     <properties>
        <property name="cwf:startDate">
           <type>d:date</type>
        </property>
        <property name="cwf:duration">
           <type>d:int</type>
        </property>
     </properties>
  </aspect>

Then, you should bind that as this:

<type name="cwf:submitLeaveTask">
        <parent>bpm:startTask</parent>
        <properties>
            <property name="cwf:leaveDescription">
                <type>d:text</type>
            </property>
            <property name="cwf:leaveType">
                <type>d:text</type>
                <mandatory>true</mandatory>
                <constraints>
                    <constraint name="cwf:leaveType" type="LIST">
                        <parameter name="allowedValues">
                            <list>
                                <value>paid leave</value>
                                <value>sick leave</value>
                            </list>
                        </parameter>
                    </constraint>
                </constraints>
            </property>
        </properties>
        <mandatory-aspects>
           <aspect>cwf:myAspect</aspect>
        </mandatory-aspects>
    </type>



回答2:


In the second Task, you have to do:

<parent>bpm:cwf:submitLeaveTask</parent>

This will inherit the field of the first form/task.



来源:https://stackoverflow.com/questions/16300942/alfresco-show-task-fields-in-another-taskview-them

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!