0

I'm new to Apache OFBiz and wanted to customize some forms, I have the following code and i wanted to show the hyperlink only for the current user record and for other user records the current user should not see a hyperlink but just text.

 <form name="ListEmplPositions" type="list" separate-columns="true" default-entity-name="EmplPosition" list-name="listIt" paginate-target="FindEmplPositions" paginate="true"
    odd-row-style="alternate-row" header-row-style="header-row-2" default-table-style="basic-table hover-bar">
    <actions>
        <service service-name="performFind" result-map="result" result-map-list="listIt">
            <field-map field-name="inputFields" from-field="parameters"/>
            <field-map field-name="entityName" value="EmplPosition"/>
            <field-map field-name="orderBy" value="emplPositionId"/>
            <field-map field-name="viewIndex" from-field="viewIndex"/>
            <field-map field-name="viewSize" from-field="viewSize"/>
        </service>
    </actions>
    <auto-fields-entity entity-name="EmplPosition" default-field-type="display"/>
    <field use-when="emplPositionId==userLogin.partyId" name="emplPositionId" title="${uiLabelMap.HumanResEmployeePositionId}" widget-style="linktext">
        <hyperlink also-hidden="false" description="${emplPositionId}" target="emplPositionView">
            <parameter param-name="emplPositionId"/>
        </hyperlink>
    </field>
</form>

I want the hyperlink in the last lines for the field "empPositionId", to be enable only for the current user record. i tried to use the and other conditions but it didn't worked, Any idea for doing it, your help will be greatly appreciated.

Paul Wasilewski
  • 9,762
  • 5
  • 45
  • 49
Waqas Ahmed
  • 88
  • 1
  • 1
  • 5

1 Answers1

1

Use the bsh condition as below,

<field use-when="${bsh:emplPositionId==userLogin.partyId}" name="emplPositionId" title="${uiLabelMap.HumanResEmployeePositionId}" widget-style="linktext">
    <hyperlink also-hidden="false" description="${emplPositionId}" target="emplPositionView">
        <parameter param-name="emplPositionId"/>
    </hyperlink>
</field>
Senthilmurugan
  • 383
  • 1
  • 14