Control How a Field is Rendered with Templates
You can customize how fields in dynamic forms and tables are rendered on a page using field templates. You can use a field template to apply simple styling details to a field, but a template can also contain UI components, for example, text fields or images, and define their properties. Components in a template can access the variables and constants, even action chains and event listeners, defined in the Layout.
The Layout you're configuring might already define default templates for some fields, which are applied in every rule set layout, but you can override them if you want to apply your own templates. Suppose the Layout defines a field template called BoldType that is applied to the Update field. If you do nothing, the Update field will have the BoldType template applied in every rule set layout where it appears. However, you can create a field template called Italics and override the BoldType template, either in specific layouts or across all the layouts that you create. You can apply your Italics template to multiple fields, as long as they are part of the same Layout.
Create a Field Template
The template editor for creating a field template is similar to the Page Designer, with a Components palette, Structure view, canvas and Properties pane. You can add components to a template by dragging them onto the template editor canvas, and then configuring the component's properties. The components you add to your template can access the variables, constants, action chains and event listeners defined in the same Layout.
When you create a field template, you can also let other extensions use it when they are extending the same Layout. After they add your extension as a dependency, they can apply your template to fields in the Layout.
To create a field template for a form field:
After creating the template, it's added to the list of field templates in the Templates tab. In the Templates tab, you can open and duplicate templates you've created.
Apply a Template to a Field
To apply a template to a field in a layout:
When you apply a template to a field, it's only applied to the field in the current layout. If you want the template applied to the field in every layout in the rule set, click Set as rule set default in the Properties pane, or open the template in the Templates tab and set it in the template's Properties pane.
Set the Default Template for a Field in a Layout
In addition to applying templates to fields in individual layouts, you can set the default field template that will apply to the rule set. The default field template will be applied to the field in every layout in the rule set. After setting a default field template for a field, you'll need to override it if you want to change the field's template in an individual layout.
To define a default field template for a field in a rule set:
In the Templates tab, the new default field template mapped to the field is added to the list of default field templates defined in the extension. In this image, in the list of Built-in default field templates, the BusinessUnitName template is crossed out to show it's been overridden by a template defined in the extension. You can remove any default field template mappings that you create by clicking next to the mapping in the list.
Add and Group Fields in Dynamic Form Layouts
When creating a layout for a dynamic form in the Rule Sets editor, you can group fields so that they are displayed together in a layout, so you can treat them as a single entity. For example, you might create an address
group that contains the fields (for example, name, address, city, state, country and post code) that you want to be displayed as a group in your layout. You can then apply conditions to the group that control when the group is displayed. A group also makes it easy to add several fields to a different layout in one step, rather than adding them individually.
You can define properties for a group (for example, a group label) and for individual fields in a group (for example, to specify column spans for fields to create complex dynamic form layouts.)
To group fields in a dynamic form layout:
After a group is created, you can still use the handles for fields to drag them into and out of a group.
Add a Link to a Page in an App UI
When extending a dynamic component such as a dynamic form, you use field templates when you want to add links to pages in your extension or in other App UIs.
For example, let's say a page in one of your extension's dependencies contains a dynamic form, and you want to add a link in the form that navigates to an App UI page in your extension. To do this, you could create a field template that contains the link, and then create an action chain that navigates to your extension's page when that link is clicked.