Zenkraft Blog

Run your Logistics and Post-Purchase Experience on the Salesforce Platform.

The new Multi-Carrier Shipping App for Salesforce is now Live on AppExchange!

Published on 10 January 2017 by in multi-carrier ecommerce salesforce 


Shipping inside Salesforce just got better, with the introduction of the new Multi-Carrier Shipping app to the AppExchange. Users can now choose between 30+ carriers to manage their logistics within the CRM platform(Multi-Carrier supports all Salesforce Editions: Group, Professional, Enterprise, Unlimited,, Developer, Performance).

Today, Salesforce users can create shipments, schedule pickups, track, and set up automation rules for carriers such us: DHL, Parcel Post, Canada Post, Australia Post and TNT.

You can find a full list of the supported carriers on our multi-carrier product page. We aim to add several new carriers each month over the coming years.

Like our FedEx, UPS and USPS shipping apps for Salesforce®, the Multi-Carrier app also brings great features to businesses searching for solutions in the AppExchange ecosystem. Companies can benefit from:

  • Sending mail or shipping packages to any Lead, Contact, Account, Opportunity or any custom object
  • Saving time with One-click shipping
  • Calculating and comparing rates
  • Generating and printing labels to standard and thermal printers
  • Tracking shipments automatically
  • All this and more without ever leaving Salesforce

Because we build our apps natively on, users can seamlessly integrate with all the order management and supply chain management apps that businesses currently use, like Kenandy, Accounting Seed, Conga Composer, Glovia, Ascent, Cloud Conversion, ChikPea, Veeva, Rootstock and FinancialForce.

Sound interesting? Book a meeting with one of our team for a personalized demo.

Can’t wait? Get started now, go to Multi-Carrier in AppExchange and start your free trial today!

Continue reading »

Bulk Shipping From a List View in Salesforce

Published on 13 December 2016 by in apex salesforce bulk shipping 

Today we are going to create shipments in bulk from the Contacts list view. By the end of this tutorial you will be able to add a button to the contacts list view as you can see here:


This will take you to the preview and bulk processing page here:


Once the shipments have been processed you will be redirected to the printing page:


Below are the steps:

1. Create the visualforce page. Code is below:


Make a note of line 11 above, this is the poller that runs every 5 seconds once we have sent our shipments to be processed. It’s used to check the current status of the bulk processing. If there are errors it will display them, or if the process completes successfully you will be redirected to the printing page.

2. Now, the main part of the programming takes places, which is our controller. Here is the full code snippet, and we will explain sections of it below:


The controller retrieves the list of selected contacts and creates a queued shipment object for each of them. Once that’s completed, we add this list of queued shipments to a bulkshipment object and then request the processing of this bulkshipmentobject via the processbulkshipments method.

Lines 6-8 retrieves the IDs of the contacts that we have selected on the previous page and Lines 10-15 selects the relevant shipping information for each of those contacts:


The next code block gets called when we click on the CreateShipments button on the VisualForce page we created earlier. The first thing we need to do is to create the BulkShipmentID that we will be adding all the queued shipments to (Line 6).

Lines 7-12 is where we create one queued shipment for each contact that has been selected, and add it to the queuedPackagesList. Line 9 is where we call the createQueuedShipmentRecord method, and we will explain this method a little later in this blog post.


For each queued shipment we have to create the package information so that UPS knows the weight and value of each package (Line 14-23).

At Line 26 we set the bulk Shipment to start the validation process, and Line 28 is where we start the poller.

The next code block is used to check the status of the current bulk shipment once it’s been sent for processing.

Some important lines to note here are:

  • Line 4, retrieves the current BulkJob status.
  • Line 21, if there are no validation errors we can send the shipments to be created.
  • Line 37, which sets where the user should get redirected to once all the shipments have been generated. In this instance we are sending the user directly to the printing page. Code below:

Now we get to the createQueuedShipmentRecord method and this is where we set the ServiceType, Packaging Type, Send from and Send to addresses.


Lastly, we call the validate and process bulk shipment methods that are referenced in the checkStatus method.


3. Finally, we tie it all together by creating the custom button on the Contacts list view to link to our new visualforce page.

We need to create a custom button on the contacts object. We do this by going to Setup > Customize > Contacts > Buttons, Links, and Actions and clicking on “New Button or Link


Complete the fields as you see here:


Next, add this button to your Contacts list view, which you can do by first going to Setup > Customize > Contacts > Search Layouts and editing the “Contacts List View” layout. Once this is done, move the bulk processing button you just created across to the “Selected buttons” section.


Continue reading »

How to Create a Shipment off a Trigger on Salesforce

Published on 06 December 2016 by in salesforce 

Here we will show you how you can create a shipment directly via a trigger on your Account object. For this example we will use our UPS app with our ShipAutomate product.

First, set up a trigger on your account object. This trigger will run each time the account is updated.


The trigger calls this apex class “AccountTriggerHandler”. The full code can be found here, but we will walk through it further down:


  1. First thing we need to do is get the UPS Shipment Preference and the associated preference details needed to create a shipment. We just select the top preference as we are only going to be using one preference on our test org.


  1. To support the Salesforce bulk process, we need to create a bulk shipment map to store Accounts and Zenkraft bulk shipments. For example, if we update a list of Accounts in Salesforce, this code below ensures that all Accounts generate a shipment.


  1. The next step is to create our queued shipment objects. This is the main section of our code and where we set all the ship to/ship from and service type details. Line 6, determines the “Service Type” and Line 9 is the “Packaging Type”.

    As the Account is a standard object, all we have to do to link the shipments generated to the account is to add this line of code: queuedShipment.zkups__Account__c = accountId; (as you can see in line 10 below).


  1. After created all the queued shipments, we are able to go to the next step, which is creating a new list of packages for each of the queued shipments. We add a package with a value of $100 and a weight of 2 pounds for each queued shipment.


  1. Final step, we loop through the bulk shipment list and call the ‘processBulkShipment‘ method to create the shipment:


Continue reading »

Part 2 of 3: Pick and Pack station on Salesforce – Custom Labels and Packing Slips

Published on 29 November 2016 by in salesforce 

Last week we wrote a first post on how we created a Pick and Pack station on Salesforce. In that post we’ve covered UI, scanning barcodes and integrating weights and scales. Today we’re focused on label generation and custom printing.

  1. Labels


  • And how it looks once printed out:
  • The quickest way to test your ZPL coding is to load your code into, and press the Redraw button, it will then show you what the label will look like once printed out.
  1. Custom printing
    • By Using our Zenkraft Printing app we were able to send jobs to the pre-defaulted printers based on user actions. Here is some example code to show how we can send labels for printing:


  • In the code above, we can see that ‘line 18’ sends the label for printing, where “this.labelId” is the attachment id of the salesforce object where the label resides.
  • For example, once a box was packed successfully and the user set the box as closed, we automatically sent two print commands; one to the thermal label printer to print out the content label (we mentioned in the previous post), and secondly we send the command to the laser printer to print out the packing slip (our PDF page).
  • Hopefully in the future HTML5 will support native browser printing, but until then our desktop app works great for automating print jobs from the browser.

Continue reading »

Part 1 of 3: How we created a Pick and Pack station on Salesforce

Published on 22 November 2016 by in salesforce 

Recently, we built a Pick and Pack station inside Salesforce for one of our customers. We really believe in the potential value it can add to user interactions, which is why we’ve decided to share pieces of how this could work for your business. We’ve created two blog posts to explain how this works. It is also worth mentioning that this can integrate with any ERP system you may already be using on Salesforce.

In this first post, we’ll be discussing: UI, scanning barcodes and weights & scales.

  1. UI
    1. We start by typing in a sales order number (custom object), or selecting a previously open one.
  1. Once on the ‘New Shipment’ screen, you can select the container size to use
  1. You can then start adding the products to pack into the container using a barcode scanner. The barcode scanner extracts the text representation of the barcode and adds it to the input box. We then do a search for that custom field in the products list and confirm its the required product. Once satisfied that everything is in order, we add the product to the container, otherwise we show an error message to that effect.
  2. Each time an item is scanned (packed), the “Total left to pack” column in the “Item to pack” line gets automatically updated. In the screenshot below you can see that we have 1 container in progress and we have packed one of ‘Item A’ and one of ‘Item B’.
  1. The next step is to “Finish container”. This will get the weight of the container (from the scales connected via our desktop app) and create a packing slip in PDF format that list items in that container.
  2. Once the containers for that shipping session have been completed, the user is able to click the Finish button. This will take into account all the shipping options such as the Service Type (Ground, Next Day Air etc etc), the weight of the containers and the dimensions, and will generate the correct shipping label.
  3. Implementing Scanning Barcodes
    • We used the javascript below, which is a combination of a few implementations, to help us with barcode scanning. We tested around 10 different libraries and found that the one we chose  worked the best across a multitude of devices.
  5. Weights & Scales
    • We have a separate interface for connecting your scales to your salesforce instance. Very similar to the standard printing management screens. It’s an API call to our desktop app that allows us to get the raw weight from the USB device that we then use to add to the shipment container.

In next week’s post, we’ll be discussing how you can create custom labels and auto print shipping labels in Salesforce®.

Continue reading »