You need to sign in to do that
Don't have an account?
Michelle Poirier
Trigger code to auto-create PDF when quote status changes to "Presented"
I'm am trying to make a trigger to auto save pdf when quote status changes to presented
Also, I have 2 templates - Would I need to specify which one to use?
I found the trigger below online but it's not working.
Any suggestions?
https://developer.salesforce.com/forums/ForumsMain?id=906F0000000907dIAA
trigger createQuotePDF on Quote (after update) { List<QuoteDocument> sr = new List<QuoteDocument>(); for (Quote q: Trigger.new) if (q.Status == 'Presented'){ sr.add (new QuoteDocument( QuoteId = q.Id, VersionData = 'someValue')); } insert sr; }
Also, I have 2 templates - Would I need to specify which one to use?
I found the trigger below online but it's not working.
Any suggestions?
https://developer.salesforce.com/forums/ForumsMain?id=906F0000000907dIAA
trigger createQuotePDF on Quote (after update) { List<QuoteDocument> sr = new List<QuoteDocument>(); for (Quote q: Trigger.new) if (q.Status == 'Presented'){ sr.add (new QuoteDocument( QuoteId = q.Id, VersionData = 'someValue')); } insert sr; }
I checked the link with below code mentioned are you getting any issue?
Thanks!
try below code. don't forget to mark it as best answer.
Thank you
@
Abhinav I used the code but nothing happens when I create/update the quote. The PDF does not get generated.
Error: Compile Error: Field does not exist: VersionData on QuoteDocument at line 5 column 9, any suggestions?