Skip to Content
Technical Articles
Author's profile photo Sookriti Mishra

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

Assigned Tags

      4 Comments
      You must be Logged on to comment or reply to a post.
      Author's profile photo Shankar Raj
      Shankar Raj

      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

      Author's profile photo Lukas Wissing
      Lukas Wissing

      Hello Sookriti Mishra ,

       

      do you know if there is a opportunity to create such rules also in fiori client? I tried to find a way but I wasn´t successfull.

      Thanks in advance,

       

      Lukas

      Author's profile photo Bharath Raj
      Bharath Raj

      Hey Lukas Wissing

      Check this

      Author's profile photo sooriya prakash
      sooriya prakash

      Hi Sookriti Mishra,

       

      Thank you so much for sharing all this info with the community. So much easy to follow. I've a query.

      I can see that it is feasible to write a Rule/Validation for "Master Page layout" but Is it possible to write a rule/validation for a custom pagelayout?

       

      Looking forward to hear from you!!

       

      Thanks & Regards,

      Sooriya