Quotes via Lightning Button
This guide will show you how you can add a Lightning Quote button to your Salesforce instance to get shipping quotes saved back onto your standard or custom object.
There are three steps needed to get this working and they are specified below.
Step 1: Create a Lookup from the Shipment object to your Standard or Custom Object
Go into Setup > Create > Objects and find the Shipment object with the zkmulti namespace.
Create a new Field with a lookup relationship:
to the object that you will be shipping with. In this guide we will be creating a lookup to the Order object.
Click Next until the lookup has been created.
Step 2: Create the Custom Address Source
Now you need to create the Custom Address Source so that the mapping can be set up.
1. Go to the Custom Address Sources tab.
2. Click on New Custom Address Source.
3. Enter in a value for Custom Address Source Name
4. For Shipment Object Lookup Field, select the Lookup field that was added to the Shipment object in Step 1.
5. For the values under the Recipient Address Fields section you can either select a custom field on your object, or use the field selector to navigate to the field needed as you can see below.
Note: Field selector. You are able to go 3 levels from your starting standard/custom object. Any related object will have a ">" that once clicked will allow you to select that related objects fields and relationships. Once you have navigated to the correct field click on INSERT to set that field
6. Populate the Recipient Address Fields, the Preference Name Field, Package Type Field.
7. Next you either need to populate the Packages Section or the Products section and utilize the Boxing Algorithm checkbox.
8. The final section you need to fill in is the Output for Rate Request section, where you choose the fields on your object (Order in our case) where you would like the Rate results to be saved.
9. Click Save
Step 3: Add the Lightning Button to your Page
Go into Setup > Object Manager > Lightning Record Pages and click on your Lightning Record Page and then click on Edit.
You can now drag the Custom Managed component onto your page. Its called GetQuoteAction.
Once on the page, click on the Button to set the custom address source id or you can even add the Field API name if the Custom Address Sources change depending on some page logic you have built.
Save your Page Layout, and your button will be there, ready for use.
Click on the Get Quote button and you will see the Quotes ready for you to select. If you have negotiated rates then those will also show.
Your rate will be saved on your object.
If you have any questions please let us know.