Skip to Content
Technical Articles
Author's profile photo Andrey Vishnevskiy

A bit more to add to C4C UI Rules

UI rules in SAP Service / Sales Cloud are great. They help to make fields visible, read-only or mandatory based on conditions. They help to hide some buttons in Actions menus for certain business roles. They make validation messages possible. They help quite a lot.

But. There is always a “but”. But the number of fields available in the field names list in UI Rules Editor is limited. Honestly, I don’t know the reason. The system doesn’t provide us with all the available fields.

For example, in the ticket TI we won’t find the following fields in UI rule available fields list:

  • Released to FSM (which is at the header level and indicates if the ticket was released to SAP FSM or not yet)
  • Order block (which comes from customer’s sales arrangement and available in “Integration” section on “Overview” tab)
  • Item processing type (which drives the item handling process)

And here we’re going to find out how to use any field available on the screen in our UI rule. To be precisely correct, any field which is available in the Data Model of the particular screen.

For this, we either need a hand from our fellow technical colleague to look up the field in SDK. Or we will need to get some help from “debug mode” in UI. I described it in details in one of my previous posts. The debugMode (aka Client Inspector) is an awesome tool which helps to explore any screen without using SDK. It can be enabled by adding debugMode=true to your usual C4C URL.

Once it’s enabled, we should check the field we want to use in our UI rule and find its “data model” binding.

We either can Ctrl + right-click the field we want to check and then navigate to “Control Model XML” tab of Client Inspector to find its bindingExpression in “Value” tag.

 

Or, being in adaptation mode (anyway we will need the adaptation mode to create or change the UI rule), right-click the field we want to check.

This will open up the field’s details in adaptation panel on the right. Notice that we don’t need to go all the way from the top element of the screen drilling down to find the field. Since we’re in debugMode, the adaptation panel has a nice additional tab called “Details”. There under “Binding Information” we can find “Binding Expression”. In the example below, I’m checking item’s Processing type. As a bonus, we can even immediately see the code for the current value if the field is a type of dropdown box.

Either way, we have the “data model” binding.
The mentioned fields have the following:

  • Released to FSM = /Root/ServiceTermsReleaseToCoresystem
  • Order block = /Root/Account_SalesArrangement_OrderBlockingReasonCode
  • Item processing type = /Root/Item/UserServiceTransactionProcessingTypeCode

Now we need to navigate to the UI rules clicking up till we see “Implementation” (it is usually on UI Component level), then into it and then into “Rules and Validations”. And here we simply replace all slashes with dots in the found binding. Ok, except the first slash. This to be removed completely:
/Root/ServiceTermsReleaseToCoresystem ⇒ Root.ServiceTermsReleaseToCoresystem
/Root/Account_SalesArrangement_OrderBlockingReasonCode ⇒ Root.Account_SalesArrangement_OrderBlockingReasonCode
/Root/Item/UserServiceTransactionProcessingTypeCode ⇒ Root.Item.UserServiceTransactionProcessingTypeCode

And we’re ready to use them. Just paste the bindings with dots into UI Rules’ editor and check the value in the bottom section.

Released to FSM:

Order block:

Item processing type:

Happy ruling!

Assigned Tags

      10 Comments
      You must be Logged on to comment or reply to a post.
      Author's profile photo suchita phulkar
      suchita phulkar

      Excellent. Thanks Andrei.

      Author's profile photo Andrei Vishnevsky
      Andrei Vishnevsky
      Blog Post Author

      You're welcome 🙂

      Author's profile photo Manish Singh
      Manish Singh

      Andrei Vishnevsky  thanks for sharing, is it possible rule can be used to setup a field value on SAP Sales Quote Object?.

      Author's profile photo Andrei Vishnevsky
      Andrei Vishnevsky
      Blog Post Author

      Manish Singh , if you’re asking about default value based on a rule, then it’s been just introduced in 2011 release. Please check release presentation from SAP, slide “Default Values using Rules – Phased Release” in Session 2 – Platform & Integration.

      Since it’s a phased release and not yet GA, you need to request SAP to enable it for your tenant.

      Author's profile photo Manish Singh
      Manish Singh

      Thank you Andrei, yes i was referring to “Default Values using Rules – Phased Release”. This new feature will help me to solve a challenging business problem.

      Author's profile photo Toon Sablon
      Toon Sablon

      Excellent workaround!

      Author's profile photo Toon Sablon
      Toon Sablon

      Hello Andrei,

      Maybe  a bit far fetched, but could this work for tabs with rows too (eg products, relationships,..)?  I wanted to make a rule based on the fact if there is a certain relationship present on the account or a certain product present on a quote.
      When using the binding 'trick', the rule will only take in account the relationship row or product row that is selected at that time (usually the first row in the rows of relationships or products). In other words I would like the code to search in all the rows). For example I know have used Root.Relationship.RoleCode and it only take sin account hte Role Code of the selected row.
      I can do this in SDK, but I was experimenting to do it in the Rule editor 🙂

       

      Kind regards,

      Toon

      Author's profile photo Andrei Vishnevsky
      Andrei Vishnevsky
      Blog Post Author

      Hello Toon,

      Have you tried exploring Data Model tab in Client Inspector?

      Cheers,

      Andrei

      Author's profile photo Toon Sablon
      Toon Sablon

      Not yet, I'll try that one. Thanks!

      Author's profile photo Mayank Agarwal
      Mayank Agarwal

      Thanks Andrei for wonderful Blog!! Really helps.