Liferay Service Builder provides users a way to customize input fields and model entities by specifying related information as model hints in a single file called portlet-model-hints.xml in projects docroot/WEB-INF/src/META-INF folder. But we need to run Service Builder everytime we update our portlet-model-hints.xml file and redeploy the portlet to see changes.
These are called as model hints as they define how entities should be presented to end users and can also specify the size of database columns used to store the entities.
When we display a portlet, it first checks the model hints we specified and customizes the form's input fields based on these hints.
Example: I have created below entity in my service.xml
To add hints to a field, add a hint tag inside its field tag. For example, I've added a display-width hint to specify the pixel width that will be used when displaying the field. The default pixel width is 350. In below example we are using the display-width hint in a field element with 50 pixels:
To see effect of hint on that field run the Service Builder again and redeploy the portlet project. It will display the width of that field in the AlloyUI input form.
We can also use the default-hints element to define a list of hints that will be applied to every field of a model. For example, adding the following element inside a model element applies a display-width of 100 to each field of that model: