You need to sign in to do that
Don't have an account?
Sarika Patel
Not able to retrieve Current Quote PDF ID
Hi,
I have a trigger that helps me to generate an email for sending the quote. The only problem is its not able to attache a quote PDF.
Here is the sample code:
List<Quote> quotes = [Select Id,ContactId,OpportunityId,(Select Id,Name from QuoteDocuments order by LastModifiedDate desc limit 1) from Quote where Primary__c = true and OpportunityId in: oppIdsToProcess];
for(Opportunity opp : Trigger.new)
{
if(opp.Probability == 100)
{
string attachId = '';
for(Quote q : quotes)
{
if(q.OpportunityId == opp.Id)
{
if(q.QuoteDocuments.size()>0)
{
attachId = q.QuoteDocuments[0].Id;
}
}
}
So I am able to go till q.QuoteDocuments.size but since the size is zero, its not able to get the doc_id. Could anyone please help? I am new to this.
I have a trigger that helps me to generate an email for sending the quote. The only problem is its not able to attache a quote PDF.
Here is the sample code:
List<Quote> quotes = [Select Id,ContactId,OpportunityId,(Select Id,Name from QuoteDocuments order by LastModifiedDate desc limit 1) from Quote where Primary__c = true and OpportunityId in: oppIdsToProcess];
for(Opportunity opp : Trigger.new)
{
if(opp.Probability == 100)
{
string attachId = '';
for(Quote q : quotes)
{
if(q.OpportunityId == opp.Id)
{
if(q.QuoteDocuments.size()>0)
{
attachId = q.QuoteDocuments[0].Id;
}
}
}
So I am able to go till q.QuoteDocuments.size but since the size is zero, its not able to get the doc_id. Could anyone please help? I am new to this.
http://corycowgill.blogspot.sg/2012/02/generating-pdf-in-apex-trigger.html
http://stackoverflow.com/questions/12510287/generating-pdf-from-trigger-future-class-in-salesforce