Sample Apex Trigger to Specify Documents or Templates

Use an Apex trigger to programmatically specify a document or template in a custom URL field. You must add a field if you selected the Different templates for different records option when you added the Quip Document component to a Lightning page.

Required Editions

Available in: Lightning Experience

This example sets the QuipTemplateUrl custom field of the Account object to the template located at the URL https://mycompany.quip.com/E5FSAel9xIsB. The trigger fires before you insert an account.

// Sample Code for setting a Quip template URL programmatically using Apex
trigger AddQuipTemplate on Account(before insert)
{
    for(Account a : Trigger.New) {
        // Set the QuipTemplateUrl custom field to the Quip template document
        a.QuipTemplateUrl__c = 'https://mycompany.quip.com/E5FSAel9xIsB';
    }   

}