Created
November 13, 2017 17:22
-
-
Save SalesforceCPQ/3ccfe3c0f9864acb3a4faff4428e48d7 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| trigger TemplateQuoteBefore on SBQQ__Quote__c (before update, before insert) { | |
| // INSERT STUFF | |
| if(trigger.isInsert){ | |
| for(SBQQ__Quote__c quote : trigger.new){ | |
| //Do Stuff | |
| } | |
| } | |
| // IF NDA has already been generated then blank out the quote template id on the quote. | |
| else if(trigger.isUpdate){ | |
| List<SBQQ__QuoteDocument__c> docs = new List<SBQQ__QuoteDocument__c>(); | |
| for(SBQQ__Quote__c quote : trigger.new){ | |
| docs = [SELECT Id, SBQQ__Template__c FROM SBQQ__QuoteDocument__c WHERE SBQQ__Quote__c = :quote.Id]; | |
| for(SBQQ__QuoteDocument__c currentDoc : docs){ | |
| if(currentDoc.SBQQ__Template__c == 'NDA'){ | |
| quote.SBQQ__QuoteTemplateId__c = ''; | |
| } | |
| } | |
| } | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment