Create a Lookup Relationship
In this example we will use the Case object.
The first step is to create a lookup from the Pickup object to the Case object. You can do this by going to Setup > Object Manager and finding the Pickup object.
Click on the New button:
Select the Lookup item:
Click next and then select the object we are going to use. In this guide we are using the Case object.
Continue to click next until the relation ship has been created. Confirm this has been done by going to a Case and viewing the new related list that has been added:
Create a Pickup Custom Address Source
Go to Pickup Custom Address Sources and click New.
Use the lookup relationship created in the previous step for the Pickup Object Lookup Field.
Pickup Location Fields
Fill in the Pickup Location Fields. Not all carriers require all fields to be filled in. Here is an example of the address fields mapped:
Some carriers (such as FedEx) require the Location and Building Type to be populated.
Package Location Field:
Values for FedEx: FRONT/REAR/SIDE
Values for UPS: Front Door/Back Door/Side
Door/Shipping/Receiving/Reception/Office/Mailroom/Garage/Upstairs/Downstairs
Building Type Field:
Values for FedEx: APARTMENT/BUILDING/DEPARTMENT/FLOOR/ROOM/SUITE
Values for UPS: Floor/Room
Shipments/Packages
You can define packaging and service related information in this section, as well as the lookup relationship for the related shipments.
Shipment Selection Condition Name Field: Is a checkbox that determines which shipments should be included. Let say you only want the shipments of type Return included, you can specify the name of that field.
Shipment Object Lookup Field: this is the shipment lookup for the related shipments.
Package Count Field: you can either add the package count manually, or it will be pulled in from the related shipments.
Total Weight Field: you can either set the total package weight, or it will be pulled in from the related shipments.
Package Type Field: add the packaging type here. For the API values see the carrier's page.
Weight Units Field: this field is used to set the weight unit for the package weight.
Service Type Field: select the default service type for the pickup. For the API values see the carrier's page.
Recipient Country Field: this will be filled in automatically from the related shipments.
Example of the shipment/packages fields mapped:
Preference
You can add the hard coded shipping preference name or map a filed to determine which preference to use when creating the pickup.
Pickup Date and Times
Most carriers also want to know the date to pickup, and the available time on that day when they are able to pickup the package. This is the Ready DateTime and Close DateTime fields. These fields are of type DateTime. Please bear in mind that the pickup date should be on the same day.
UTC Time Field: If this is checked then the date and time is calculated in UTC.
Reference Number Field
You can put a reference here, for example the Case Number, or a PO.
Special Information
Some carriers require special information to be added to the pickup, such as the service category or the currency.
FedEx:
Pickup Service Category: SAME_DAY/SAME_DAY_CITY
Carrier Code Field: FDXE/FDXG
Error Handler
You can use an text field to handle errors in case of automated pickup creation.
Automation Settings
If the Auto Create Pickup is checked then the pickup will be automatically created when you click New Pickup.
Create Pickups Using the Wizard
Go to your record, in this example a case, and click on new pickup.
Select the preference or check that the correct one is pulling in via the pickup custom address source.
Fill in or check the address details.
From v1.114 address validation is available for pickups.
Select the pickup date and time.
Fill in the pickup details.
Select the related shipment(s). By selecting the shipments the package data will be automatically pulled in.
In this section all shipments will be displayed that fit the following criteria:
- Pickup lookup on the Shipment record is empty (Pickup__c = null)
- Shipment is not delivered (Delivered__c = false)
- Shipment Processing is completed (Shipment_Processing_Completed__c = true)
- Shipment is not deleted (Shipment_Deleted__c = false)
Edit the package details if you are not using a related shipment.
Check the pickup availability.
If all the information is correct then click on the Create Pickup button to finish the process.
Create Pickups Using Automation
There are two common ways to set up the automated pickup creation: either from a standard or custom Salesforce object, or when the Shipment is created.
Create Pickup from a Standard or Custom Object
In this example we are going to create the pickup when the case status changes.
Go to Setup > Process Builder and create a new process.
Select your object and set the start of the process to "when a record is created or edited".
Next set the criteria for when this process should run. In this example we will run the process when the Case status changes to "Pickup".
Finally, create a new immediate action and choose Apex, and in the possible Apex Classes choose the "Create Pickup (Multi Carrier)".
You will then have two fields that are required to be filled in. The first is the pickup custom address source ID, which you can copy from the URL of the pickup custom address source, and the other is the record ID, in this example the Case ID.
Save each action and activate the process builder.
Now if you go back to your case and change the status the pickup will be created automatically.
Create Pickup after a Shipment is Created
Go to Setup > Process Builder and create a new process.
Set the object to be the Multi-Carrier Shipment object and start the process when a record is created or edited.
For the Criteria make sure you set these condition on the field "Shipment Processing Completed" to be True, and ensure you utilize the Advanced dropdown to execute the actions only when specified changes are made to the record.
Set the scheduled action to run 0 Hours After CreatedDate, this means the pickup code will run after the shipment has been created and won't interfere with any other processes.
Finally, create a new action and choose Apex, and in the possible Apex Classes choose the "Create Pickup (Multi Carrier)".
You will then have three fields that are required to be filled in. First the pickup custom address source ID, which you can copy from the URL of the pickup custom address source, second the record ID, in this example the Case ID, and third the Shipment ID.
Save each action and activate the process builder. To test the process simply create a new shipment.