--- title: "Configure templates" slug: "configure-templates" description: "Learn how to configure agreement templates that you can use to build new agreements. " updated: 2024-05-14T12:56:06Z published: 2024-05-14T12:56:06Z canonical: "docs.zilliant.com/configure-templates" --- > ## Documentation Index > Fetch the complete documentation index at: https://docs.zilliant.com/llms.txt > Use this file to discover all available pages before exploring further. # Configure templates You can optionally configure templates for use in Deal Manager. Templates help save time by allowing your pricing team to pre-build agreements with lines and enabling sales reps to copy templates into new agreements. ## Create a set of agreements or quotes to use in a template You can create agreements to be used as templates from scratch, including lines, sublines, and other starting values. Alternatively, if you've enabled the ability to copy agreements or quotes, you can copy an existing agreement or quote that's close to being an ideal template and modify it. ## Define copy directives used by your templates Use the **Copy** functionality described in [Configure Copy action](/v1/docs/configure-copy-action-button) to copy the content of template agreements to a new agreement. The copy directive determines which records and fields are copied from the template agreement to the new agreement. Each agreement or quote you define as a template is assigned to a template record, and that template is associated with a copy directive. It is common that all of the templates you define will use the same copy directive. But that does not have to be the case. If you have two different distinct types of templates, you may need a different copy directive for each, and that is possible. You can associate a template with a copy directive by specifying its **Copy Directive Name** value in the template. ## Define one or more templates Define one or more templates to include in a list for users to choose from: 1. From the **Lightning App Launcher**, select **Templates**. 2. Select **New** to create a new template. 1. In the **Template Name** field, specify a user-friendly name for this template. 2. From the **Status** dropdown, select **Active** to ensure the template will be visible to users in the **Template List** Lightning component. 3. In the **Price Lookup**, **Contract**, and **Deal** fields, specify the object name that corresponds to the object for this field. 4. In the **Copy Directive PriceLookup**, **Copy Directive Contract**, and **Copy Directive Deal** fields, specify the directive for this object's template. 5. In the **Description** field, specify a user-friendly description to help sales reps understand when to use this template in their agreements and quotes. 3. Select **Save**. 4. Repeat this process for each new template you want to define. 5. Drag the **Template List** component to any place on the page layout. ## Filter templates shown in the Template List component You can create a **zpl.TemplateListProvider** Apex Hook that contains custom logic to filter active Deal Manager **Templates** shown on a page. The hook has access to the Deal Manager document attributes as well as active **Templates** attributes. The hook then uses these attributes to allow a user to pick a template from a subset that is determined by the business rules of the Deal Manager implementation. #### Functional input 1. **sObjectId**—target object id. 2. **sObjectType**—type of the target object. You must develop a new Apex Hook class. - It must implement the **TemplateListProvider** interface. - It must have a global access modifier. ``` global interface TemplateListProvider { List getTemplateIds(Id sObjectId, String sObjectType); } ``` #### Example 1 ``` global with sharing class sskTemplateProvider implements zpl.TemplateListProvider{ global List getTemplateIds(Id sObjectId, String sObjectType) { ID currentRecord = sObjectId; String agreeRegion = [SELECT ssk_Acct_Sales_Office__c FROM Contract WHERE Id = :currentRecord].ssk_Acct_Sales_Office__c; String agreeYear = [SELECT ssk_Term_Year__c FROM Contract WHERE Id = :currentRecord].ssk_Term_Year__c; Map templates = new Map([SELECT Id FROM zpl__Template__c WHERE ssk_Term_Year__c = :agreeYear AND ssk_Sales_Office__c = :agreeRegion]); return new List(templates.keySet()); } } ``` #### Example 2 ``` global with sharing class TestTemplateProvider implements TemplateListProvider{ global List getTemplateIds(Id sObjectId, String sObjectType) { Map templates = new Map([SELECT Id FROM Template__c]); return new List(templates.keySet()); } } ```