Using Variables for Icons

I notice that often we reference the icon for a given business object in multiple places, in page properties (side nav icon), in buttons, etc.

Is the right thing to do here to define variables in the project Environment Variables section for things like this, or somewhere else?

Environment variables are used for things that will change by runtime environments. A good example are credentials to access the app’s databases. These would be different in each environment. You can read more about these here: Environment Variable.

If you are trying to parametrize client-side details (icon name in your example) that won’t change without distributing new code, you could use project parameters. They are normally used to configure content in a library (you can read more here: Parameter Values. In your case, you could try adding a new project parameter and specifying a default value (“factIcon” with a default of “done” for example). Then you can put “PROJECT_PARAMETERS.factIcon” any place you would use “done”. The generate code will replace “PROJECT_PARAMETERS.optionsOptionality” with “done” in your generated code.

1 Like

with an icon defined as a project parameter, am trying to define it in the settings for a UI page.

but in the settings ‘sidenav icon name’ for the UI page, it doesn’t show the right icon using:
PROJECT_PARAMETERS.placeIcon
Also tried putting {{ }} around it, with no luck.

Is there another syntax needed?
And, in this specific UI, it shows the icon dynamically to the right of the definition (along with an option to use outlined if available), I assume the project parameters are not evaluated dynamically, so I shouldn’t expect the image to show once I get the right syntax, right?