Code list restriction (CLR) for SAP Hybris Cloud for Customers
About myself and this Blog:
My name is Mayank and currently i am working as Developer associate in SAP Hybris Cloud for Customer UI/Framework team. I am writing this blog to make the life easier for key users of SAP Hybris Cloud for Customer Product as i have worked on this topic as a develper. This blog will give overview about the key user functionality called code list restriction and some frequently asked questions about the same.
Audience for this Blog :
All SAP Hybris Cloud for Customer Key Users/ anyone interested in SAP Hybris Cloud for Customer Product.
It is generally a technique which is helpful in restricting the values displayed in the drop down, or in other words user can control the values displayed in any drop down in SAP Hybris Cloud for Customer system.
Code list restriction can be created based on four parameters :
i) Business Object
ii) Code to restrict
iii) Control field
iv) Business role.
Among the above four parameters first two parameters are mandatory while creating a code list restriction.
Step by step procedure to create and maintain code list restriction:
- Go to administrator work center, click on code list restrictions.
- Click on new button and enter the required fields. Select the business object. As per the business object selected, the code to restrict field will be populated select the field which has to be restricted.
- Then select the Control field (optional)- there are two option in control field business field and extension field if the selected business object is standard business object (the business object basically provided by the SAP), there will be only one option called custom field if the selected business object is custom BO (the business object basically developed by partners).
- Then select the business role (optional).
- After filling the required fields click on save or save and open.
- Then maintained all the values as per requirement in restriction tab and default value tab and click on save.
One scenarios of code list restriction:
Scenario: Only business object, code to restrict field and control field is used to create a code list restriction entry.
Example: If a field called Source under the business object Sales Lead has to be restricted based on some value selected in the field test_sap.
- Go to Administrator work center.
- Go to General Settings.
- Click on Code list restrictions.
- Click on New button.
- In the pop up select the business object as Sales Lead, code to restrict field as Source and control field as test_sap.
- Save and Open.
- In the next screen just uncheck all the values which should not be allowed in the Source drop down based on the values selected in test_sap field. For example, for value ‘A’ in test_sap if value should not be displayed then uncheck the value Roadshow under the column A. Similarly, for other fields.
- Save your changes.
After setup now just see how it is working.
- Go to work center Sales and then click on work center view Sales Lead.
- Click on any record to open Sales Lead TI (thing inspector).
- Now select the value ‘A’ in the sap_test field and click on Source drop down, you will not see Roadshow which was restricted/unchecked.
- Now select the value ‘C’ in the sap_test field and click on Source drop down, you will be able to see all the fields as no values were restricted.
FAQ (Frequenty asked questions) on Code list restriction
1. Which field can be used as a control field? Some fields are not available as controlling field which creating a new code list restriction.
Ans: Only business field (not all fields) exposed by application team or extension field of type code (list) or indicator can be used as a control field.
2. Which field can be used as a code to restrict field? Some fields are not available as code to restrict field which creating a new code list restriction.
Ans: Only Code fields (list) exposed by application team or extension field of type can be used as code to restrict field while creating a code list restriction. If any Standard field is not exposed, please contact SAP.
3. Code list restriction is not working for a field with control field.
Ans: If control field is not present in the screen then code list restriction will not be applied.
4. Code to restrict field is showing wrong/incorrect values and not respecting the values which is maintained.
Ans: First verify if the same code to restrict field is controlled by more than one control field then the values will be the intersection of all the code list restriction maintained or in other words it will be the common values of all code list restriction.
5. Any particular screen where CLR does not work?
Ans: Code list restriction does not work in Contacts advance search.
6. Does code list restriction work in offline mode?
Ans: Yes, code list restriction works in offline mode.
7. Where Code list restriction default value works?
Ans: Default value only works on quick create screen add row (list modification) and not on advance search or TI (thing inspector).
8. Default value is not working for a field in quick create with control field.
Ans: Sometimes default value does not work with control field when control field is changed due to missing round trip, so external round trip like pressing the ‘enter’ key is required to set the default value.
9. Where all code list restriction works?
Ans: Code list restriction basically works on quick create, advance search and TI (thing inspector) screen.
10. Code list restriction in not working in Silverlight.
Ans: Code list restriction works in HTML5 and RUI. We are not supporting in Silverlight.
11. In code list restriction quick create after selecting some business object the controlling field screen got changed and instead of business field and extension field, custom field is shown.
Ans: When user selects a custom Business object (Custom BO)/ PDI created business object then controlling field shows the custom field OVS (object value selector) in which all the Code/List or indicator fields are displayed.
12. In code list restriction, no default value is maintained, even then some default values are set in quick create.
Ans: Check if some default values are set using BC (Business configuration) fine tuning, or any default value is set by corresponding application team.
13. Some values in code list restriction are not restricted (unchecked), even then it is not shown in UI.
Ans: Check if there is any context binding done in UI designer to restrict some values.
14. Some fields are not coming as code to restrict field while creating a new code list restriction even if it is code type.
Ans: If the field is standard field (fields provided by SAP), then application team has to expose the field if they want to allow to create any code list restriction for that field. Only the field exposed by corresponding application team will be visible. If it is a valid requirement, then please contact SAP.
15. In code list restriction TI-> Default values tab, it is showing codes/technical name/garbage value.
Ans: Just check if the value is restricted in restriction tab, if so then user has previously saved a default value which was restricted, so it is showing code values instead of description. So please maintain the correct default value which is not restricted.
16. In any TI (Thing inspector), the field is showing code value/garbage value instead of description for which code list restriction is maintained.
Ans: This usually happens when a value is saved and later on a code list restriction is created for this field and the value is restricted. In this case it is advisable to edit the TI and change the value to a valid one.
17. In code list restriction TI one extra column is coming named ‘Type’.
Ans: For code field of having ListID field (same field used in many work center view, example category field in activity BO), we are showing one extra column to handle ListID case so that the restriction in different work center view will work properly. This is the new feature from 1705 release.
18. Is CLR works in TI facet area?
Ans: It works, if both code to restrict and control field are in facet area only.
After reading this blog, hope you will now know the basics of code list restriction functionality in SAP Hybris Cloud for Customer Product and some of your doubts would have been already cleared with the FAQ section. If any further help is needed on this topic, you can ask the same in comment section.
SAP Hybris C4C UI/ Framework Team