Generate return labels from web2lead

Published on 13 March 2019 in multi-carrier returns 

A very easy, almost non-code way to offer self-service return label generate on your website is using Salesforce's popular web2lead capabilities. We've outlined the steps below to get this setup. 


1.Generate the web2lead code

Login to your Salesforce instance and go to Setup > Customize > Leads > Web-2-Leads. Click the Create Web-2-lead Form button. The following fields are required to create a shipping label:


We will hide the lead Source field. You should add a new lead source called something like Requested Shipping Label.


2. Embed form on your website

Next you should embed the web-2-lead form on your website. The only change we need to make is to apply style="display:none" to the Lead Source section and default it to Requested Shipping Label. This will enable us to run a process builder task of this lead source.


3. Install the Multi-carrier app 

Next you should install our Multi-carrier app. Follow the guide here to get setup:


You will need to create a custom address source that looks up to the Lead object. Here is the guide:


4. Setup a process builder on the lead to send a label

Once the Multi-carrier app is setup and you have added a Preference for your shipping carrier (a test FedEx account is available here) you can create a process builder task. You will need to set the Lead Status = Requested Shipping Label as below:



Next selected an Immediate Action. And choose Apex Class and Create Shipment. You should enter the Custom Address Source ID that you created in step 3 and set the recordId as a field Reference of Lead ID. 




5. Setup a second Process Builder to Send the label

Now that a shipping label will be generated when a web-2-lead form is submitted, we now need to email it to the customer. This can be done with a second process builder task based on the Shipment object:



That's it! Now it's time to try it out by completing your web-2-lead form. You should receive a shipping label in under 10 seconds via email.