Use Simple and very powerfull Data Model in Debug Mode for SAP C4C
As a C4C technical developer some times we develop somethings which can be made available with the help of Rules like visibility , readonly!
PDI is very powerfull tool but with More power comes more responsibility 😀 and some times a Embedded component could lead to decreased system performce.
I had a requirement to make a URL mash up link only avaiable on display mode , and if some certian fields are filled. Again , being a developer my mindset is like lets do it via PDI but then later I saw a blog from Jerry Wang ( awesome tehchnical guy!) : https://blogs.sap.com/2017/09/14/how-to-detect-editmode-in-an-embedded-component/
He used a Data Model field and made it avialble in EC to render the visibility.
We will do the same thing but not with EC , we will do it with Visibility rules
1.Identify the Fields and logic with which you want to change visibility.
Use Case : We have two URLs , a. Create , b. View.
I want Create to be visible if C4C object is in display mode and if the external object is not yet created which is determined via a KUT dield.
I want View to be visible if the external object is created and C4C object is in display mode.
Get the techincal IDs of the field from data model
- Edit mode
- External object ID (KUT field)
Go to debugMode in your tenant. add a parameter debugMode=true in url
click on cntrl+right click on the field u want to make condition.
Same way get the KUT field from Data Model
Get as many fields you want based on your condition.
2. Now go to vibility rule for the field or any other object in my case its a URL Mashup link.
Edit the master layout.
and thats it!! Just play aroud with it..:)
I hope it helps and reduce some efforts for the developers!