--- title: "TemplateProvider" slug: "templateprovider" updated: 2024-05-14T12:36:26Z published: 2024-05-14T12:36:26Z canonical: "docs.zilliant.com/templateprovider" --- > ## 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. # Template Provider Class The Deal Manager **Template** feature allows a user to populate a new Deal Manager document with values and lines from an existing Deal Manager document that was previously designated as a **Template**. For more information on the Template feature, see [Configure templates](/v1/docs/configure-templates). The **TemplateProvider** hook can filter all active Deal Manager **Templates** that a user can choose when applying a template to a Deal Manager document they are working on. The hook has access to all of the attributes of the Deal Manager document that the template will be applied to, as well as all attributes of active Deal Manager **Templates**. The hook can use these attributes to allow a user to pick a template only from a subset determined by the business rules of the implementation. This hook is called when the **List** of all available Deal Manager **Templates** is presented in a Lightning **Record Page**. ## Apex hook class - It must implement the **TemplateListProvider** interface. - It must have a global access modifier. - You must specify the Apex hook class name in the **Template Provider Class Name** field of the **Copy Configuration** in the **Custom Metadata Type**. ## Interface definition ``` global interface TemplateListProvider { List getTemplateIds(Id sObjectId, String sObjectType); } ``` ## Example 1: Class implementation This example pulls the **Region** and the **Year** from attributes attached to the **Current Agreement** being worked on and returns templates that have the same **Year** and **Region** values in the respective attributes on the template. ``` 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: Class implementation ``` 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()); } } ```