While working on a customer project we realized creating value help using smart field will save a lot of our time. How you can understand while going through this blog.Also, I can see many blogs have already been written on creating Value helps using smart field. But the difference here is that I needed to pass filters as parameter and hide them so that users cannot modify.
This last requirement of hiding the parameters itself took a lot of my time. So for the benefits of others decided to write this blog.
BUSINESS SCENARIO:
There was one form containing the fields similar to below screen.
On click of Sales Office one F4 value help has to open and the values are to be filtered based on Division selected as in below screen shot.
SOLUTION
This can be achieved by adding smart field in the view xml file and using annotations on the oData model metadata.
XML FILE:
<smartForm:GroupElement label="{i18n>SalesOffice}">
<smartField:SmartField value="{ZSalesOff}" >
</smartField:SmartField>
</smartForm:GroupElement>
For smart field to be editable base entity set must be updatable true.
LOCAL ANNOTATIONS:
OR in the code editor,
Till this point the steps are like that explained in Samples. Here Record Type: Common.ValueListParameterIn determines the filtering data set which is Division for our example.
This results in a value help like below screen shot,
Issue here is that user can modify the resultant set.
To avoid this and hide the filter use the below annotation on the property of entity.
I hope this will help other users to solve this quickly.