function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Nick D'AddarioNick D'Addario 

Generate Quote Document with Apex Trigger

I have a requirement to automatically generate a quote document once a quote's status is set to "In Review." I'm able to succesfully create the quote document record, but the actual document itself is not being generated. I also tried scheduling the MassQuoteDocumentSender class and had the same result. Here is what I have so far:


trigger createQuotePDF on SBQQ__Quote__c (after update) {

List<SBQQ__QuoteDocument__c> sr = new List<SBQQ__QuoteDocument__c>();
    for (SBQQ__Quote__c q: Trigger.new)
         if (q.SBQQ__Status__c== 'In Review'){
                 sr.add (new SBQQ__QuoteDocument__c(
                 SBQQ__Quote__c = q.Id,
                 SBQQ__Template__c = 'Standard Quote' 
                 ));  
         }
   insert sr;
    
}


Any help would be greatly appreciated!