Using Rules and Validations in SAP C4C
SAP C4C application has slowly gained richness in the features and functionality it offers. Especially in the Key User Tools (KUT) arena the richness of features is amazing. One such robust tool is the Rule Editor feature which enables us to configure rules and validations.
Rules are written using Ruby script made easy with a set of operators and functions. These rules are of great use while working with visibility of fields, sections, and other user interface components. One of the very useful feature of rules has been described in this blog post: Driving Field default values with Value type rules in SAP C4C
Validations sit on top of rules and gives us the power to make the system alert the user on an incorrect input of data. We could also use validations to add a hard stop instead of just an alert.
Let’s now try to understand how this can be achieved.
Step 1 – Let’s head to Adaptation Mode
Click on your name on the top right and click on Start Adaptation
Step 2 – Now we need to find the Implementation option (by clicking on Back arrow till we hit implementation)
. Then hit Implementation to go to Rules and Validation
Step 3 – As I mentioned earlier, Validations sit on top of rules and hence before we create and apply validations, we need a rule in place for our requirement. So, let’s create it first.
Let’s click on Add Rule and add script it using operators and functions as shown in the screenshot below. We are using the BOOL function to check if the indicator is marked as Yes or No. Now we want to create a validation if the indicator is marked as NO . Hence we are using NOT. Based on your business requirement, you can play around in the script
Save the rule.
Step 4 – Now, we go back to Implementation and head to Add -> Validation
Here let’s specify a relevant Validation name (continuous text), Description (descriptive text), Severity (Error, Warning, Information) and the message that we want to display on the User Interface.
Severity decides how the system would behave when validation is triggered on user action and is governed by it’s values viz. Error, Warning and Information
While Error results in a hard stop for the user, Warning and Information allow the user to proceed with the action with a soft message. For the purpose of this blog post, let’s use a Error (process to set up an warning and information is similar).
Once the message is set, we go ahead and select the rule created earlier and hit apply to the validation we just created.
This completes the set up for Validation in SAP C4C system. Now let’s look at how it impacts the system behavior and meet the business requirements.
We open an opportunity and set the flag as No and see how system reacts. When the flag is set as No, the system gives a warning
Now if we set the flag to Yes, there is no warning on competitor information
We can also limit the validation to certain business roles by using MYROLES function. Based on the business requirement and using the functions provided by SAP, we can design these validations
I hope this blog post has helped you in understanding how to use the Validations and make use of the functionality to achieve the Business requirement of validating certain fields entry. If you are looking for more information on how to use Rules and Validation , click here to read from SAP HELP
If you have any questions, please feel free to ask or leave your feedback.
Good info with relevant details. Thanks a lot for writing this post. Really helpful.
Thank you Prashant 🙂
Nice blog Chandrakant!
Thank you Srinivasa 🙂
Hi chandrakant kulkarni
Thanks for sharing this info with the community. Really Helpful. I've got one query.
I know it's feasible to write a Rule/Validation on Master Pagelayout. Is it possible to write a Rule/Validation specific to a Custom page layout and not affecting any layouts.
Looking forward to hearing from you.
Thanks & Regards,
I have the same problem.
Hi Chandrakant, I've entered in the instance thru the browser and went to Adaptation mode to add color to a ticket based on the ticket status. I've went back till Implementation but I can only see the standard Rules but no Validations. I've tried to add PDI_Development permission but then Start Adaptation is not available.
Any help would be appreciated. Kind regards and thanks. Matías.