Upload UPS Tracking Numbers for Tracking in Salesforce

This post will show you how you can upload ups tracking numbers from a CSV file into salesforce, and have our UPS app provide you with tracking updates.

For this example we will use a Sales Order object that has two fields. One for the tracking number and one for the ship date you will be uploading.

 

The first thing you need to do is create a look up from the UPS Shipment Object to your Sales Order object, if you haven’t already done so. If you are unsure how to do this, please look at step 4 in this guide.

Once you have your look up relationship, you need to create a UPS Custom Address Source entry. Click on the “UPS Custom Address Source” tab, and then click New.

Fill out the Custom Address Source Name, select the Sales_Order__c under object, and make sure that you populate the Shipment Object Lookup Field. Your screen should look like this:

Click save.

Next please create a new Process Builder task and give it an appropriate name such as “Bulk Upload Tracking Numbers”

Next we have to select the object we are going to look for changes on, that will then create the UPS shipment for tracking. In our case we select “Sales Order”.

Click save, and move onto the “Add Criteria” section. This is where we need to check that a tracking number has been added and a ship date has also been added. Fill in the fields as you see below:

Click save, and then choose “Add Action”.

As you can see from the screen above you need to fill in quite a few fields.

  1. Set the “Action Type” to be “Apex”
  2. Fill in “”Action Name”
  3. Under “Apex Class”, ensure you choose “Track Shipment (UPS)”.

You will now need to set all the variables: Below is an explanation of each one:

preferenceIdType: IDValue: is the Salesforce ID of your UPS Preference. The id can be found by navigating to the preference and copying the last part of the URL.

trackingnumberType: Field ReferenceValue: choose the field on your Sales Order object where the tracking number will be populated

recordId – Type: Field ReferenceValue: choose the RecordId of this Sales Order object. This is what you should see:

createShipmentIfNotFoundType: BooleanValue: True or false. If the shipment tracking number is not found in UPS system then continue to create the shipment record.

customAddressIdType: IDValue: this is the ID of the Custom Address Source we created earlier. To get the ID just click on your Sales Order Custom Address Source object and copy the ID form the URL:

Click save and don’t forget to Activate this process builder task.

We are now ready to start using Dataloader.io to load in your data.

Go to Dataloader.io and sign in using your salesforce login, then select New Task

Then click on “Import”:

Select the object we are going to upload our details to, in our case the Sales Order:

Click next, and you will then be able to choose your CSV file to upload. You also have other options of where to get your data from, but thats beyond the scope of this blog post.

After click Next you will need to map the columns in your CSV file to the fields on your Salesforce object.

Once you click next, you are presented with this screen:

The most important part of this page is setting the Batch API to run 1 record at a time. Please double check you have set this otherwise the process builder task will only run once, and not for each row in your CSV.

Click Save and Run.You should now see the task running:

Whilst this is running you should be able to go into your salesforce and click on Setup > Monitoring > Apex Jobs and see a screen similar to this that shows the individual shipments being created:

If there are any errors you will see them displayed here.

When you now go and view any of your Sales Orders you will see the UPS Shipments objects in the related list, and this will update the tracking details according to your scheduled tracking settings.

Please contact us if you have any questions.

 

 

About the author

Adrian Miotto
By Adrian Miotto