INTRODUCTION
When working with C4C, there could be a common requirement which is that a field should be only visible under certain conditions.
STANDARD FIELDS SCENARIO
On those cases where the field is standard, this could be easily handled by entering into Adaption mode (currently through HTML5 version) and setting a visibility rule on the desired standard field as shown on the following screenshots:
When opening the rule modeler you will be able to define the desired set of rules through the following tool:
CUSTOM FIELD SCENARIO
However, on those cases where the field has been added by, for example, extending a Business Object through PDI, it is not possible to handle its visibility through Adaption mode. Basically, it does not show the option to access into rule modeller.
SOLUTION
The solution for handling this scenaroi will consist on:
First, create a boolean function (that returns a field of type Indicator/boolean) on a ReuseLibrary for indicating whether the custom condition for your requirement is met or not, based on it, the function will return True/False.
Then, on the Data Model of the screen where the custom field is, create a data field called “ShouldShowCustomField” (marked as True on property "Is a Dedicated Field").
Next, on the Controller tab of the screen where the custom field is, create a Field Transformation which connects the data field and the new function. In order to be able to connect the function, it must be marked as UI Designer relevant.
Finally, it is required to set a CalculationRule over the Visible property of the custom field which checks whether the “ShouldShowCustomField” is True/False and, based on it, show or not the field.
FINAL COMMENTS
This requirement could have been solved on some other ways, for example, by creating a transient field on the BO extension and an Event Handler on the Controller of the screen. However, it was quite straight forward to handle this on this way.
Hope you all find this helpful!
Cheers.
Alejandro.