Wednesday, November 2, 2016

SAP Hybris Cloud for Customer - Rule your Cloud!

“When field X has value 1, than field Y should become visible and mandatory”... a question that C4C consultants or administrators didn't like to hear! Simply because it was or not possible or it was a hell of a, time spending, job to meet these requests through creating page lay-outs. One of the new C4C functionalities in the 1611 release, called Model Rule Property, enables Key-Users to fulfill these much heard requests in a simple way!

The steps below will show how to define rules to change the property of fields.
In the following scenario the agent can choose to automatically share the solution of the ticket with the customer. When the agent selects “Share solution”, fills in the “Solution”  and the “Resolved on” date, a workflow is triggered that sends out an e-mail including the solution. Without filling the “Resolved on” date the workflow isn’t triggered, therefore this field needs to be mandatory.
The challenge is that the “Resolved on” field should only be visible and mandatory when the “Share solution” is selected so that the ticket screen is clearly organized and that this happens before saving the ticket.

1. Navigate to “Adapt” and “Edit Master Layout”. 

2. Select the field.

Navigate to and select the field for which you want to determine property rules.
By clicking on the Change Properties you can create rules to determine if this field should be visible, mandatory or read-only. In this scenario we want “Resolved On” visible and mandatory only when the field “Share Outcome” is checked.

3. Create the rule.

When creating the rule the first step is to fill in the “Rule Name”. By clicking on the icon that is marked green you can enter the Rule Name. Hereafter you can filter and search for the fieldname that you want to use in the code for rule.

Using the filter option helps to quickly find the field you need. By clicking on the + sign the field will be added to the code. After adding the field you need to select an operator or function that can be used in the code. In this case we add the operator “Equal To”  to the code by clicking on the + sign here as well. After selecting the correct field and operator or function you need to determine the last part of the code. The code until this moment is field “Share Outcome” is “Equal To”. Because the “Share Outcome” field is an indicator field type (checkbox) the field has the values 0 (unchecked) and 1 (checked). Therefore we add the value 1 to the code, which is now complete. By clicking on “Apply” the rule is created and saved.

4. Apply the rule for field properties.

Rules can be used for multiple property definitions, like in this specific scenario where we can use the same rule for making the field visible and mandatory.

The outcome of these rules is that when selecting “Share Outcome” immediately the field “Resolved On” becomes visible and mandatory, an action that can’t be achieved via creating new page lay-outs because that will only work on “on-save” events. Therefore the Module Rule Property functionality is very efficient to make sure that users see and fill in the correct fields dependent on values entered in other fields. Cloud for Customer will depict a warning message when the user tries to save the object without filling the field that just became mandatory because of the rules that has been activated.

This blog provides insight in a very easy and useful key-user functionality which can minimize the creation of multiple page lay-outs. To conclude the most important aspects of the Model Rule Property functionality are:

  • Rules are defined by administrators/key-users that have the ability to adapt the master lay-out.
  • Rules to change the property of fields applies for fields, sections and facets.
  • Rules can be applied to make fields visible, mandatory or read only.
  • Rules can be defined for both KUT-fields as for standard fields. 
  • Rules aren’t applied on “on-save” but immediately when the rules are met. 
  • The rules are executed only on client side, not on server.
  • Rules will apply both online and offline.
  • Rules are applied to the Master Lay-Out. The module rule property can be seen as the replacement for creating page lay-outs.
  • It is possible to make rules by comparing the date fields.
  • Key-users can disable all the Model Property Rules at once via “Adapt” --> “Disable Key User Property Evaluation”.