Skip to Content
Technical Articles

SAP C4C | Writing on-screen validation/ rules for fields.

SAP C4C | Writing on-screen validation/ rules for fields.

Hi Readers,

This blog will guide you to write validations without PDI development in SAP Cloud Application Studio.

This blog is written while C4C is in the 1908 version, and so far, all these custom validations can be written only in the HTML5 version. Hence, switch to HTML by clicking on “Launch HTML5”.

Now, in the HTML5 version, click on Adapt, and then click on Edit Master Layout.

Hover on the field for which you wish to write validations, and then click on to add validation.

Now, click on New to start the process.

 

In the Overview, enter a validation name, description, and select the Severity. So, based on the severity of the validations, you can either pass an error message/ warning message/ information.

 

In the Editor tab, you are required to write the logic on basis of which you wish to trigger the message. Here also, you are required to enter a Rule Name, and a description.

 

Write the Code as shown in the screenshot below and you can see the realtime value in the bottom. In my case, the result is “false”. There are different Operators and Functions available which have been provided based on all possible scenarios. Hence, the given Functions and Operations will definitely serve your purpose.

 

In the Messages tab, enter your message which you wish to pop-up in the screen in case of the condition getting satisfied. Click on Apply after you are done creating the validation.

 

Now, click on Adapt, and click on “End Layout Changes” to save all the validations written.

 

TESTING TIME!!! Scenario 1:

Scenario 2:

Thanks! I hope it helps. Any doubt? Please feel free to drop a comment.

 

Thanks & Regards,

Sookriti Mishra

SAP C4C and CPI Consultant

1 Comment
You must be Logged on to comment or reply to a post.
  • hi Sookriti,

     

    This is really Nice, thanks for the blog !!!

    I have one question –¬† is there a way to display validated field value in the Message¬† ?

     

    Regards

    Shankar Raj