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”.

10 comments:

  1. have you create a rule to change properties like uppercase and lowercase? it doesn't work for me...

    ReplyDelete
    Replies
    1. Hi Michael, what is your case? For example.. if you want to create a rule to make a fieldmandatory when value Z3 is met the rule should be: IF (field == "Z3", true, false).

      Delete
  2. Hello good day.

    I would like to know if I can remove the required field from a standard field? And which rule should I use.

    Thanks and regards.

    ReplyDelete
  3. Hi Rosmary,

    Not a lot of fields are standardly mandatory in C4C. If you can't change the mandatory box via field property/field definitions than C4C made it mandatory for a reason. Unfortunately a rule wouldn't work than as well. Rules are mainly applied for making fields mandatory, visible or read-only based on certain conditions, not the other way around (so making them not mandatory).

    ReplyDelete
  4. Ok, thank you very much for the help, if I reappears another doubt I will write again to see if you help me.

    Greetings.

    ReplyDelete
  5. Hi, do you know how to add rules for additional fields in c4c?

    For example, create a field called 'interest' and I want it to load another field that calls 'Industry' when selecting a value from the list.

    Is it possible to do it with rules?

    For example, I created a field called 'interest' and when I select a value from this list, I want to automatically load a value referring to 'interest' in another additional field which I call 'Industry'.

    I do not know if I could explain.

    regards

    ReplyDelete
    Replies
    1. Hi Rosmary, if I understand you correctly you want to have the following, for example: If field A has value 1, field B must be filled default with value 5. This is not possible by creating rules. Rules can only be used for defining the field properties of fields (visible, read only, mandatory).

      However you can achieve your request by creating a workflow which update a field with a certain value when conditions are met.

      Delete
  6. Hi, This is very good option to use. Can anyone provide information whether having Rules at many conditions will impact performance during page load? I have this doubt because validation can happen only after the data being loaded in respective fileds. Please provide input.

    ReplyDelete
  7. Hi Shridhar. At my customer we use some rules (around 10-20, with multiple conditions) but we don't see that this really influence the performance during page load. Of course it will take a bit longer, but until now we have experienced that this is around 1 second.

    ReplyDelete
  8. Hello,

    Thank you for the informative use of rules in C4C, this is very helpful. I have followed this and have a question. We have some customer presence in Kosovo, so I've created the country in C4C as it's not standard. However, now, if I'm creating a prospect with country Kosovo, it is requiring me to populate a state, which we don't populate or even have configured for Kosovo. Therefore, I'd like to make a rule that makes State optional when country is Kosovo. So I figured the Mandatory rule for the state field is: Country not equal to Kosovo. Is there a flaw in my logic?

    Thanks!

    ReplyDelete