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
Shannon Andreas 1Shannon Andreas 1 

Custom button to replace standard quote button

Hello!

I am trying to find a way to prefill fields on the Quote record with field values from the Oppty. The standard quote button pulls in the oppty and acct names automatically as it has a parent-child relationship. It also pulls in the Quote Line Items that are synced from the Products Line Items on the oppty.

I don't have anything to show here because I am not sure what to use to get this done. I was thinking javascript button, but then thought it might take apex code and a possible vf page. All of which I am pretty inexperienced with. I can probably wing the javascript as I found some basic code that might work (although I am having a hard time referencing the opportunity id and account id of the oppty to the Quote).

Can someone point me in the right direction? I would need a response that is somewhat detailed on how I can approach this. 

Thanks for your help!

Shannon
scottbcovertscottbcovert

Hi Shannon,

This can be accomplished using what's called 'URL hacking' As you guessed, you can create a javascript button on the opportunity object that executes javascript (specifically window.location = 'CUSTOM_URL'; ) where CUSTOM_URL looks something like the following:

/0Q0/e?retURL=%2F{!Opportunity.Id}&oppid={!Opportunity.Id}

You can find more information about this technique here:
http://raydehler.com/cloud/clod/salesforce-url-hacking-to-prepopulate-fields-on-a-standard-page-layout.html

You can also prepopulate additional values by adding more URL parameters ( &XYZ={!Opportunity.Custom_Field__c} ) where XYZ is the field to be prepopulated, you may need to do some digging to discover what value to use here.
Shannon Andreas 1Shannon Andreas 1
Thanks Scott. I should have mentioned that I use URL hacking quite often. I think my situation is a little more complicated because 1.) there is a master-detail relationship with the Opportunity and I can't seem to find the right API name for the opp name and account name and 2.) I need the quote to include the quote line items which is also a master detail relationship but between the Quote and Quote Line Items objects.

Does anyone have experience with this particular situation?
scottbcovertscottbcovert
Hi Shannon,

I see-perhaps someone else has experience traversing through relationships and can chime in. In the meantime I'd perhaps give {!Opportunity.Name} & {!Opportunity.Account.Name} a try for getting the opportunity & account names, respectively. Good luck!
Shannon Andreas 1Shannon Andreas 1
I'm actually doing that right now ;)

Thanks again for your response Scott. I do appreciate it.