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
RakeyshRakeysh 

configuring dynamic quotes

Hi
i have business reqirement on quotes as follows

 

theres is terms & condition section on quote ,in this section there are 5 pointers explaining terms & condition

 

now the 1st  two pointers are dynamic and will change case to case (customer) basis.

 

the last 3 terms & condition pointers are static (standard) will remain same for all case  (customer) basis.

 

now how can i handle this scenario efficiently on quotes or in template or ...pls suggest best way to handle this scenario

bob_buzzardbob_buzzard

This sounds like you'll need to create the quote programmatically.  I've done this in the past  - the route I went was:

 

(1) Create a visualforce page with the opportunity standard controller and a renderas attribute of PDF.  This produces the actual qoute and has an extension controller if necessary to pull in other information as required.

 

(2) I had a visualforce page embedded in the standard view with lots of customizations - if you don't have that you may need to tweak this.  I added a button to this page that fired an action method to create a Quote record and attach a QuoteDocument to it, the body of which was the content of the visualforce page created in step 1.

 

While step 2 sounds a little complex, there isn't that much code:

 

Quote qt=new Quote(OpportunityId=opp.id,
	           Name='MyQuote' + opp.Name);
insert qt;
PageReference pr=Page.MyQuotePage;
pr.getParameters().put('id', opp.id);
Blob content;
if (Test.IsRunningTest())
{
   content=Blob.valueOf('UNIT.TEST');
}
else
{
   content=pr.getContent();
}
QuoteDocument doc=new QuoteDocument(Document=content,
                                    QuoteId=qt.id);
insert doc;

 Note the Test.IsRunningTest check, as you can't use getContent in a trigger.

Jerun JoseJerun Jose

Do you require the last 3 points of your T&C to be available in the quote detail page ? or just on the PDF generated?

 

My suggestion would be to have a field T&C on quote detail to capture the first 2 points.

 

You could then use this field on the template and add the remaining 3 points as static text on the template.

 

If you are worried about the formatting or need to display the complete set on the UI, you could use a formula field which will combine all 5 points into 1 field and use that in the template.