Our invocable method allows you to create a UPS Shipment object as long as you have a UPS Tracking Number.
You also need to have our Custom Address Source object set up if you want to relate this Shipment object to your Standard or Custom object.
This can be achieved using Process Builder and our standard UPS Shipmate for Salesforce App.
For this guide we will work from an Order object.
Firstly make sure you have two custom fields available on the Order Object where the user will add the tracking number and the shipment date (optional):
Step 2: Create Process Builder Task
Create a Process Builder Task by going to Setup > Create > Workflow & Approvals > Process Builder and click the New button.
Give the process a name, description and choose to start the process when "A record Changes".
Next choose the object you are starting the process from. Remember in this guide, we are using the Order object, and we will be running the shipment creation once the Order object has the Tracking Number and Ship Dates filled.
Make sure you set "Start the process" to be "when a record is created or edited". Click Save, and then select "Add Criteria".
We need to look out for two conditions to be met.
- Tracking Number has been changed
- Tracking number is not null
This is how your page will look:
Next add an Immediate Action. The Action Type will be "Apex", and the Apex Class will be "Track Shipment (UPS)".
There are now 3 Apex variables that need to be set, and up to 6 variables that can we set. Below is an explanation of each one:
preferenceId - this is the FedEx Shipmate Preference ID
trackingNumber - this is the tracking number you want to track
createShipmentIfNotFound - if set to True, a new shipment object will be created if the tracking number does not already exist as a shipment on Salesforce
(optional) recordId - the Order ID (in this case)
(optional) shipDate - the date this tracking number was created
(optional) customAddressId - if you want to relate this shipment to your Order (in this case) you need to specify the Custom Address Source ID, so that the link can be made.
For the customAddressId please set it to the Custom Address Source ID that you are running this process from. To get this ID, navigate to your Custom Address Source and copy the last part of the URL. If you are in lightning just use the first 15 characters of this objectId.
For the recordId please set the Type as Field Reference , and the Value to be the Object ID. In our case it will end up being the Order ID.
Once all these fields have been added your screen will look like this:
Click Save, and don't forget to Activate this Process Builder
That is all set, you will now be able to have shipments created via process builder for tracking
Once you have activated the process builder, go to an Order object, add the tracking number and the shipment will be auto-created.
If you have missed a step and the shipment isn’t created, you can view error message under Setup > Jobs > Apex Jobs.
The error messages are extremely helpful in debugging.
Please contact us using the icon to the bottom right of this screen if you have any queries, and we will be glad to help.