Skip to Content
Author's profile photo Mayank Khemka

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.

Overview :

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.


  1. Go to Administrator work center.
  2. Go to General Settings.
  3. Click on Code list restrictions.

  1. Click on New button.
  1. In the pop up select the business object as Sales Lead, code to restrict field as Source and control field as test_sap.

  1. Save and Open.
  2. 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.

  1. Save your changes.

After setup now just see how it is working.


  1. Go to work center Sales and then click on work center view Sales Lead.
  1. Click on any record to open Sales Lead TI (thing inspector).
  1. 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.

  1. 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.


Conclusion :

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.


Best Regards,

Mayank Khemka

Associate Developer

SAP Hybris C4C UI/ Framework Team

Assigned Tags

      You must be Logged on to comment or reply to a post.
      Author's profile photo Suraj Pai
      Suraj Pai

      Hi Mayank Khemka Jeevan Gowda Kunigal Nanjegowda

      To ensure that support consultants do not accidentally set a ticket to Status Closed, we have implemented a CLR hiding the Closed status.

      The users however need to be able to query the list of Closed tickets through Advanced search.


      I see that the CLR implicitly restricts the code list in advanced search as well. Is there any way we can overcome this.


      Appreciate a speedy response.

      I have asked this as a separate question in the community for you to answer: '

      Thanks and best.. Suraj

      Author's profile photo Suraj Pai
      Suraj Pai

      I found a way out:

      By assigning the CLR to only the Support business role and thus allowing me as administrator access to the 'Closed' code.

      Unfortunately, the way C4C is designed this code list restriction takes affect also in the advanced search filter criteria. Hence Support User role would not be able to make a query with status closed. I can because my administrator role does not have this restriction.

      What I have done now is created a Saved Query called Closed tickets, and cascaded it to all users.


      Select that and hit the “Advanced Search” button at the top right corner of the list.


      As you may see, the Status = ‘Closed’ condition is already there as a criteria. You may add other conditions like Customer ID(using value help f4), consultant assigned, etc. In case you want to add more statuses to the criteria please use the “More Options” link next to the status field:


      Notice below the drop down does not give you “Closed” as an option for Status, hence do not touch that line. Simple use the “+” button to the right and enter other statuses in subsequent lines.

      After you have given all the criteria, use the ‘Save Query’ button to give your query a name, after which you can simply select this query the next time onwards.


      Too many steps, but this is the only way I found to get around.


      Best.. Suraj

      Author's profile photo Vignesh Karuppasamy
      Vignesh Karuppasamy

      Hi Mayank,

      We restricted the field Role in Account workcenter in such a way that it should show only prospects. (Only prospects are allowed to be created in C4C)

      We have few C4C specific fields which is being maintained directly in C4C. But due to above code list restriction the changes are not allowed to save for accounts of Role Customer.

      Please advise how to over come this problem.


      Vignesh K

      Author's profile photo Mayank Khemka
      Mayank Khemka
      Blog Post Author

      Hi Vignesh,


      There are couple of ways this can be achieved:

      1. If you want to restrict the value of the Role for some specific business user and want others to use the value Customer, then you can set up the code list restriction for specific business role and it will solve your problem.
      2. If first option does not suit your business use case then, the CLR error messages can be suppressed using business configuration. In business configuration search for code list restriction and set the error message severity and suppress message check box as per your requirement. Refer below screenshot:


      Hope this will resolve your problem.

      Best Regards,


      Author's profile photo MURUGESAN DEVARAJAN

      Hi Mayank,

      In Account BO we maintained one CLR based on the Account Type value the Account sub Type need to show. But it is not working as per expectation.


      When I create an Account with a Account type and Subtype in Quick view, and then in Overview
      screen I change the Account type .. the Subtype remains with the old value  and does not refresh as per CLR. 
      Can you please suggest your views.


      Author's profile photo Mayank Khemka
      Mayank Khemka
      Blog Post Author

      Hi Murugesan,

      You can set up default value for this case, because if you set up only restriction, when you change the value of controlling field, the value in code to restrict field does not change,, but it only shows the allowed value in the drop down when the field is clicked. Hope this helps.



      Author's profile photo Pushpa Ray
      Pushpa Ray

      Hi Mayank,


      I would be really grateful if I can get a response from you.

      We are facing an issue while creating "Contacts" in SAP. There is field called "Function" which has  different values( currently only 7 values are visible for the users) but when the users create the "Contacts" from Outlook add in for SAP C4C , the same field "Function" shows more than 7 values which users don't want to be visible in the add in. So how can we sync both SAP c4c and outlook add in view for above. Could you please help me out.


      Many Thanks,