You are here:
Edit and Access Rights for UI Elements
In UI contracts, use bindings to apply edit and visibility permissions to UI elements such as buttons, tabs, and context menu items.
Required Editions
| Available in: Lightning Experience in Professional, Unlimited, and Enterprise Editions that have Consumer Goods Cloud enabled. |
In a binding, the values of the attributes type and target are always set to Editable or Visible. The permission itself is either true or false, depending on the value from the binding source. Then there’s either a binding attribute or a call attribute.
Buttons and Tabs
For buttons (directly visible menu items) and tabs (<Tab>), the permission bindings, Editable and Visible, have a call attribute or a binding attribute. The binding attribute can be a process context variable, or the simple property of a business object. For syntax details, see the Context Menu section. The call attribute calls a method that determines the editability or visibility of the menu item or tab. A parameter is optional. The method returns a boolean value.
<MenuItem directlyVisible="true" itemId="completeCall">
<Bindings>
<Binding type="Visible" target="Visible" call="ProcessContext::MainBO.getButtonVisibility">
<Parameters>
<Input name="token" type="Literal" value="btnComplete" />
</Parameters>
</Binding>
<Resource target="Text" type="Label" id="completeCallId" defaultLabel="Complete Call" />
<Resource target="Icon" type="Image" id="CheckCircleGrey24" defaultImage="light/done2_24.png" />
</Bindings>
</MenuItem>Context Menus
For a context menu, the permission bindings, Editable and Visible, have a binding attribute that is based on a simple property of type DomBool from the data source of the context menu. The value of these bindings can be manipulated in the load method for the data source.
<ContextMenu>
<Bindings>
<Binding target="DataSource" binding="ProcessContext::ContextMenuList.Items[]" bindingMode="ONE_WAY" />
</Bindings>
<Items name="ContextMenuItems">
<Bindings>
<Binding target="Icon" type="Image" binding=".actionImg" />
<Binding target="Text" type="Label" binding=".actionId" />
<Binding type="Editable" target="Editable" binding=".actionEnabled"/>
<Binding type="Visible" target="Visible" binding=".actionVisible"/>
</Bindings>
</Items>
</ContextMenu>
