• wisconsam
  • NEWBIE
  • 0 Points
  • Member since 2011

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 1
    Questions
  • 1
    Replies

I am hitting a bit of a hard spot here, and wanted to see if anyone had any bright ideas.  There is a limitation of the basic functionality of roll-up summary fields to use filter criteria from a formula field containing cross-object references.  This has been referenced on idea exchange (link below) and has documentation expressing the limitation, "...system fields like Last Activity, cross-object formula fields, and lookup fields (such as the Product Codefield) cannot be used in the field column of roll-up summary filters."  I understand it would be possible to get what you need into a report that performs the function, but if the value will be used in a communication template, that is not a viable option.  Workflow rules would also allow the field to be replicated to a standard field that could be used in a roll-up, but they would only be relevant if it was assumed that all child objects would be modified at some point prior to action of requiring these values.  As some of the data could be already present, that is not optimal as well.

 

Has anyone else experienced this frustration that would be willing to share a solution?   Or has anyone found a method of getting an aggregate sum of objects to output the total value into a visualforce page?  I am at a bit of a loss of exactly what is required to try and get the equivalent of the roll-up into a communication template, so it is more then possible that I am going down the wrong track.  I would assume that the best option would involve an apex class related to something else that would not require a triggering action.  Any advise or corrections would be appreciated.

 

Thanks!

 

 

Idea Link: https://sites.secure.force.com/success/ideaView?c=09a30000000D9xtAAC&id=08730000000Bra0AAC

 

 

Is it possible to auto-generate a quote pdf based on changes to the quote line items.  For example, a quote and quote line items have already been create, and a quote pdf has been generated and attached to the quote and is shown in the quote pdf related list.  Now, the user goes back and changes values in the quote line items.  Is there a way to automatically generate a quote pdf after the user makes these changes to the line items?   Meaning, another quote pdf will appear in the related list based off the changes made to the line items?

 

I'm currently trying to see if it's possible to generate a Quote Document with a trigger on the Quote, below is some code for the trigger, but I'm stuck at specifying the template name, the only template I have access to is a template I created called "Testing"  :

 

Can this even be done? If so, how would I specify the template to use?

 

Thanks in advance!

 

trigger createQuotePDF on Quote (after update) {
List<QuoteDocument> sr = new List<QuoteDocument>();

    for (Quote newQuote: Trigger.New)
         if (newQuote.Quote_Approval_Status__c == 'Quote on Hold'){
                 sr.add (new QuoteDocument(
                 Template = 'Testing'));  
         }
   insert sr;
 }