Here's a solution for a challenge that many people have experienced with Quotes in Salesforce®.

Here's How we Solved it 

At Passage Technology, we recently developed a solution on our internal systems for a challenge that many people have experienced with Quotes in Salesforce®.

When you create a new Quote record from an Opportunity record in Lightning, the Quote record doesn't fill in the Opportunity master detail field automatically. 

A Simple Solution that Works in Classic and Lightning

The solution we came up with at Passage Technology solves issues with the Lightning "New Quote" functionality by populating required fields automatically and works for standard quotes. It provides a way to implement a single Custom button, which detects whether the user is in Classic or Lightning and handles quote creation in both contexts correctly. What this means is that the solution successfully logs a new quote with the correct behavior, in a way that works in either Classic and Lightning. 

No Custom Code Required 

Passage Technology's solution uses the standard Salesforce interface and process, just overridden with extra parameters to fix some issues that otherwise made it unusable in Lightning. It can be done without adding any custom code overhead to your org. Initially, it was challenging for us to figure this out, but we totally thrive on challenges. The result: a solution that can easily be implemented in five minutes – without needing to understand code. Another great benefit is saving on added maintenance and resource costs when you use a lightweight declarative solution like this.

How it Works

I'm using Lightning, but the solution can also be configured in Classic. For brevity, I'll just explain showing the Lightning UI, however, the same steps apply in Classic:

First, create a custom button for Opportunity:

1.) Go to Setup > Object Manager > Opportunity

2.) Navigate to "Buttons, Links, and Actions" section for Opportunity

3.) Click "New Button or Link" in the top right

4.) Input the label. name, and description as you like, I used:

  • Label: "New Quote" 
  • Name: "New_Quote"

5.) Set "Display Type" to "Detail Page Button"

6.) Set Behavior to "Display in new window"

7.) Set Content Source to "URL"

8.) Copy and paste the formula below for the main body of the URL of the button:

{!If

   (

OR

    (

$User.UIThemeDisplayed == 'Theme4d',

$User.UIThemeDisplayed == 'Theme4t'

    ),

 URLFOR("/lightning/o/Quote/new?&defaultFieldValues=OpportunityId="&Opportunity.Id&",Name="&Opportunity.Name&IF(Opportunity.Primary_ContactId__c != null,",ContactId="&Opportunity.Primary_ContactId__c, '')),

           URLFOR("/0Q0/e?retURL="&Opportunity.Id&"&oppid="&Opportunity.Id&"&Name="&Opportunity.Name&"&Contact_lkid="&Opportunity.Primary_ContactId__c)

   )

}

Note: In the above example, "Primary_ContactId__c" is a custom field used to track the main contact for an Opportunity. So if you want to pre-populate the contact relationship as we did, you'll need to replace this with whatever you use in your own environment to track this information on the Opportunity. However, it can be removed if this is not needed without causing any issue. You can also use this approach to pass in any other custom relationships to populate fields on the Quote.

9.) Save your new custom button

10.) Go to Page Layouts for your Opportunity object, and edit any page layouts on which you want to include the button. If you want to hide the standard Salesforce "New Quote," which appears on the quote related list, you can do so from the related list for quotes via the wrench icon in the "buttons" section, while in the Edit Layout screen.

Formula Without Optional Contact Field Parameter

Here's a version of the formula minus the optional contact field parameter, just the essentials that should work out of the box.

{!If

    (

OR

    (

$User.UIThemeDisplayed == 'Theme4d',

$User.UIThemeDisplayed == 'Theme4t'

    ),

URLFOR("/lightning/o/Quote/new?&defaultFieldValues=OpportunityId="&Opportunity.Id&",Name="&Opportunity.Name),

URLFOR("/0Q0/e?retURL="&Opportunity.Id&"&oppid="&Opportunity.Id&"&Name="&Opportunity.Name) 

    )

}

 

 

By Evan Montigney, Internal Systems

 

 

 

 

Share