Adding template fields and integration links to an object
Template fields are similar to template-based HTML components, but can be used in views and page layouts because they are part of an object definition. Integration links require URL encoding. The Platform template engine automatically selects the correct encoding rule, but you must enter URLs using the correct syntax. You can use template fields in combination with other field types to deeply customize the Platform user interface (see the example below).
Template fields have an option to hide the display label that is normally shown on the left in pages. This feature is especially useful for creating a single piece of JavaScript code to be added to multiple pages.
- In an Object definition page, scroll down to the Fields section, click New Field and select Template or Integration link as the Field type.
- If you chose Template, enter HTML for the field's body and embed any Template merge tokens as needed using the merge field helper.
- If you chose Integration link, enter link URL.
- Preview the resulting field by clicking the Preview Template or Preview Link link.
In this example, a related field on the Order object points to the email address of a related user. This related field will display a link to send an email to that user. To add a link to send an email using Order fields to a different related email address, create a template field with the following HTML Template:
<a href='../m/send.jsp?act=clean&id={!id}& objDefId={!#OBJ_ID.order}&to={!relatedEmail}'>{!relatedEmail}</a>
This template will render a link to a Send Email page using fields from the current Order record, and the email address from the related field.