background

Zenkraft Blog

Zenkraft Blogs about Logistics, LSPs, Integration with CRM, ERP and WMS applications.

Multiple Package Returns for UPS and Auto Printing

Published on 28 February 2017 by in ups returns 

This weeks post will detail how to achieve the following using our package, and some apex code.

  • Multiple Package Returns for UPS
  • Auto Printing

Multiple Package Returns for UPS

Currently the UPS api only allows the creation of 1 return label at a time. So if you want to create 20 return labels at once you need to set up a batch process to create them individually but group them into a Bulk Shipment which then allows you to print them all off at once.

We first need a method to create our bulk shipments, which we then reference later on in a loop.

Line 2: create a new queuedShipment object.

Line 3: set this new queuedShipment to be in the bulkShipment object.

Line 4-9: Sets the payment type, service type, units, labeltype, packaging type and the account this shipment is related to.

Lines 12-20: sets the sender address from the shipping preference.

Lines 23-30: set the recipient address details from the account.

Liens 33-35: set the values needed to create a return shipment.

 

Then we utilise a loop for the number of labels we will be creating. The code to loop through and to eventually send the shipments to be created is here:

Line 5: Create the bulkShipmentId that we will then send for processing after we have created the queuedShipments

Lines 10-21: This is the for loop where we go through creating the list of queuedShipments and creating the packages that are also required.

Line 28: is where we send the bulkShipment to be processed.

Lines 44-55: show how to create the packages.

 

Auto Printing

Our package is already setup to auto print a shipment label and all related documents from the shipment view page. All you need is the salesforce id of the shipment that has been generated. After shipment creation, you need to redirect the user to the shipment using the code below, and as long as you have setup the users default printers in the “Manage Printers”, the printing of all the labels and documents related to that shipment will automatically print on the respective printers. For example if you have a thermal shipping label and an international document, they will be printed to the thermal printer and to the laser printer respectively.

String redirectUrl = ‘/apex/zkups__ShipmentViewV2?autoprint=1&id=’ & shipmentId;

Any questions, please contact us and we will be happy to help you out.

Continue reading »

Convert a GIF shipping label image to PDF

Published on 31 January 2017 by in apex salesforce 

In today’s blog post we’re going to show you the codes needed to convert a GIF shipping label into a PDF document.

We’re going to use pages, classes, and controllers.

APEX Class

The first method we need to look at is regenerateGifToPdfLabel (line 2). The steps are as follows:

The createPDFLabels (line 25) method in step 3 above calls the generatePDFLabel method (line 35).

Next create a new attachment object pdfLabel, which will be the PDF file (line 36). Line 38 is where we reference our VisualForce page, that will contain the original GIF file. The VisualForce page code can be found at the bottom of this post.

Line 41 sets the Body of the new attachment object as the blob that is returned from the standard SalesForce method getContentAsPDF();.

 

APEX Controller

Line 6-7 basically set the variable that will be used in the VisualForce page.

 

VisualForce Page

Line 25 is where the GIF shipping label is inserted, which is then rendered as a pdf from the code we have already looked at from above.

 

Happy coding.

Continue reading »

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

Published on 10 January 2017 by in ecommerce salesforce 

multi-carrier-email-image

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, Force.com, 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 salesforce.com, 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 »

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:
labelary-online-zpl-viewer-google-chrome-2016-11-28-11-27-20
  • The quickest way to test your ZPL coding is to load your code into http://labelary.com/viewer.html, and press the Redraw button, it will then show you what the label will look like once printed out.
online-zpl-viewer
  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 »