Templates
A Required Compliance Template (seven20__Required_Compliance_Template__c) is a collection of Required Compliance (seven20__Required_Compliance__c) records.
Templates can be created in one of two ways:
- When assigning Required Compliance to a record, you can choose to save the Required Compliance as a template
- Via the Compliance Template Manager component
Compliance template manager component
The compliance template manager is an LWC component that allows you to create, edit, and delete compliance templates through a centralised interface. It is capable of being placed onto a custom Lightning App Page.
On the left hand side of the component is a panel that lists all of the templates that are available to the current user. At the top of this panel is a button labelled Add. Clicking the Add button, or clicking on an existing template opens the right hand panel. This is where you can edit the template.
At the top of the right hand panel is a header section, this section displays the compact layout of the currently selected template, as well as a button labelled Delete, which when pressed opens up a modal for a user to confirm they wish to delete the template. If the user is creating a new template, this header section will simply display the text New Template.
Below the header is the main body of the component, this is where you can edit the template. At the top of this section is the Template Details section, where the template name can be defined and a button labelled Save Template which updates the template with the current details.
Next, there are two picklists which allow the selection of required compliance. This is done by firstly selecting the Type with the left hand picklist, and then selecting the Sub-Type with the right. Selecting a Sub-Type will add the required compliance to the template. Under this is where the required compliance records are listed, in a table. Each row in the table represents a required compliance record. The columns are as follows:
| Column | Field API Name | Description |
|---|---|---|
| Compliance Type | seven20__Type__c | The type of compliance, e.g. Id |
| Sub-Type | seven20__Sub_Type__c | The sub-type of compliance, e.g. Driving License |
Additionally, each row has a checkbox, which when selected will cause the record to be deleted when the Remove Selected button at the top of the table is pressed.
The compliance template manager does not support record types on compliance.
Required compliance template objects
The required compliance template object is a very simple object, with no custom fields. Only the Name field is required. Instead, the required compliance template object is a collection of required compliance records.
For a required compliance record to be flagged as being part of a template, the following fields need populating:
| Label | Field API Name | Type | Description |
|---|---|---|---|
| Template | seven20__Template__c | Lookup(seven20__Required_Compliance_Template__c) | The template that the record is part of |
| Template Item | seven20__Template_Item__c | Checkbox | Set to true, to indicate it's a template item |
Additionally, no other lookups should be populated.
There are no restrictions around creating templates and templated items programmatically.