In Classic, I can launch the NewQuote dialog using an URL like so:

let url = "/0Q0/e?nooverride=1&oppid=0060900000NKZXQ&retURL=%2F0060900000NKZXQ";

Note that this code brings the dialog up with certain fields (Account, Pricebook, CurrencyIsoCode) pre-populated from the Opportunity and on Save the Opportunity's line items are copied to the new Quote - everything works just like the standard NewQuote button.

Is there a way to do the same thing in Lightning? I am thinking of something like

let url = "/lightning/o/Quote/new?...";

My plan is to override the NewQuote action button with a VF page that adds parameters (URL Hack) which pre-populate a number of custom fields before launching the standard NewQuote dialog.


My problem is not (or not yet) the URL-Hack; the question is how to get Lightning to do the same thing it does when I click the built-in (not yet overridden) New Quote button in the Quotes related list.

What I did so far (and where I am stuck) is:

  1. I click the New Quote button (not overridden!); this brings up the New Quote dialog.
  2. I copy the URL that is displayed; it looks like this: https://myorg-dev-ed.lightning.force.com/lightning/o/Quote/new?count=1&nooverride=1&useRecordTypeCheck=1&navigationLocation=RELATED_LIST&uid=166370128014080937&backgroundContext=%2Flightning%2Fr%2FOpportunity%2F0060900000NKZXQAA5%2Fview
  3. I leave the New Quote dialog by pressing Cancel.
  4. I paste the previously copied URL into the search bar at the top and press enter. The New Quote entry form displays - but the Opportunity lookup field is not initialised and I get an error when I click Save.
  5. I make the problem go away by adding &defaultFieldValues=OpportunityId%3D0060900000NKZXQAA5; when I now save, no error is thrown, a Quote is created, but the line items are not copied.

Exactly the same thing happens when I redirect from my VF page using the sforce.one.navigateToURL() call shown above: when I explicitly set the OpportunityId I can save the new Quote, but the line items are not copied.

In conclusion, it appears that not everything that can be done in Classic can be done with the same ease in Lightning Experience.

BTW: I know I can just create a VF Page that does the entire work up to and including the creation of the line items; but this last thing is what I hoped to be able to avoid - it just feels stupid to have to reverse engineer a functionality available out of the box and losing the flexibility offered by the user modifiable page layout into the bargain.



Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.