Search code examples
alfrescoalfresco-sharealfresco-webscriptsalfresco-enterprise

display workflow task custom properties on edit task page only (not on workflow details or task details page) alfresco share


I need to hide workflow task custom properties from the workflow-details and task-details page and show only on task-edit page.Currently it is visible on all the three pages. abcmodel.xml

<type name="abc:review">
            <parent>bpm:activitiOutcomeTask</parent>
            <mandatory-aspects>  
            <aspect>abc:Info</aspect>
            </mandatory-aspects> 
            </type>
<aspects>
      <aspect name="abc:Info">
         <properties>
             <property name="abc:Det">
             <type>d:mltext</type>
             </property> 
        </properties>
      </aspect>
</aspects>

shareconfigcustom.xml

<config evaluator="task-type" condition="abc:review">
                    <forms>
                         <form>
                            <field-visibility>
                                <show id="abc:Det"/>
                                <show id="bpm:comment" />
                            </field-visibility>
                            <appearance>
                                <field id="abc:Det" label="customproperty" read-only="true">
                                <control template="/org/alfresco/components/form/controls/textarea.ftl">
                                <control-param name="style">color: black</control-param>
                                <control-param name="rows">6</control-param>
                                <control-param name="columns">6</control-param>
                                </control>
                                </field>
                                <field id="bpm:comment" label="Comments">
                                    <control template="/org/alfresco/components/form/controls/textarea.ftl" />
                                </field>
                            </appearance>
                        </form>
                    </forms>
                </config>

Solution

  • You can use form-id to control them. To hide the field(abc:det) in the workflow details page, you can use like,

        <config evaluator="task-type" condition="abc:review">
        <forms>
             <form>
                <field-visibility>
                    <show id="abc:Det"/>
                    <show id="bpm:comment" />
                </field-visibility>
                <appearance>
                    <field id="abc:Det" label="customproperty" read-only="true">
                    <control template="/org/alfresco/components/form/controls/textarea.ftl">
                    <control-param name="style">color: black</control-param>
                    <control-param name="rows">6</control-param>
                    <control-param name="columns">6</control-param>
                    </control>
                    </field>
                    <field id="bpm:comment" label="Comments">
                        <control template="/org/alfresco/components/form/controls/textarea.ftl" />
                    </field>
                </appearance>
            </form>
             <!-- Form configuration for workflow-details page -->
            <form id="workflow-details">
                <field-visibility>
                    <hide id="abc:Det"/>
                    <show id="bpm:comment" />
                 </field-visibility> 
                 <appearance>                               
                    .....
                </appearance>
            </form> 
             <!-- Form configuration for task-details page -->
            <form id="task-details">
                <field-visibility>
                    <hide id="abc:Det"/>
                    <show id="bpm:comment" />
                 </field-visibility> 
                 <appearance>                               
                    .....
                </appearance>
            </form>
        </forms>
    </config>
    

    I hope you can use, '' to configure the task-details, but I haven't tried it yet.

    Update For the task-details, there is no specific form-id is used in data-form section. Refer C:\<Alfresco_Home>\tomcat\webapps\share\WEB-INF\classes\alfresco\site-data\pages\task-details.xml

      <!-- Data Form -->
      <component>
         <region-id>data-form</region-id>
         <url>/components/form</url>
         <properties>
            <itemKind>task</itemKind>
            <itemId>{taskId}</itemId>
            <mode>view</mode>
            <formUI>true</formUI>
         </properties>
      </component>
    

    To customise this task-details form, I added <formId>task-details</formId> as mentioned below.

      <!-- Data Form -->
      <component>
         <region-id>data-form</region-id>
         <url>/components/form</url>
         <properties>
            <itemKind>task</itemKind>
            <itemId>{taskId}</itemId>
            <mode>view</mode>
            <formUI>true</formUI>
            <formId>task-details</formId>
         </properties>
      </component>
    

    You need to use share extension / customisation best practices to change the OOTB files in share. Alfresco Share extensions

    Finally in the share-config-custom.xml file add the configuration like,

     <form id="task-details">
        <field-visibility>
            <hide id="abc:Det"/>
            <show id="bpm:comment" />
         </field-visibility> 
         <appearance>                               
            .....
        </appearance>
    </form>     
    

    All set to go and it is working fine to me.