Table of Contents

  1. Introduction
  2. Integrating
  3. FedEx Bulk Shipping Fields

1. Introduction

The following information provides guidance for integrating the Zenkraft Bulk Shipping Platform into your org. The Bulk Shipping Platform allows for the processing of bulk/high-volume shipments. As it is a platform, some custom integrating is necessary to accommodate your company’s specific shipping needs. The Bulk Shipping Platform was built to provide flexibility, to ensure your company’s specific shipping needs are met. Through the use of Apex and Visualforce, the Bulk Shipping Platform can be extended to provide a custom shipping experience.

2. Integrating

The Zenkraft Bulk Shipping Platform allows you to processes a high volume of shipments in batches. It allows you to define every aspect of the shipment(s) and then validate the shipments in bulk, and also allows you to process the shipment(s) in bulk. Both domestic and international shipment validation and processing are supported.

Also, bulk printing is supported. You must first have Zenkraft Shipmate setup to print successfully.

There are several objects you will be using. FedEx Queued Shipment and FedEx Queued Package are the objects you use to define each individual shipment. Then, to combine them into a bulk shipment queue, associate the Queued Shipment records to a FedEx Bulk Shipment. The FedEx Bulk Shipment object acts as your shipping queue. All commands to validate and to process queued shipments are operations on the FedEx Bulk Shipment record. Once you insert all those records to define your shipments, you use the Apex class BulkShipmentInterface to validate or process the shipments, passing the class the ID of the FedEx Bulk Shipment record.

The zkfedex.BulkShipmentInterface.validateBulkShipment() method takes the ID of the Bulk Shipment record and a Boolean as parameters and performs basic app validation on each Queued Shipment associated to that Bulk Shipment record. The Boolean performAddressValidation parameter of the validateBulkShipment() call should be set to true if you want to have address validation on the Recipient Address (Return-From address of return shipments). This address validation is primarily added for those who would use FedEx Ground and need to determine residential vs commercial locations to choose between FedEx Ground and FedEx Ground Home Delivery services.

The zkfedex.BulkShipmentInterface.processBulkShipment() method takes the ID of the Bulk Shipment record as a parameter and generates the labels for each Queued Shipment associated to that Bulk Shipment.

Both zkfedex.BulkShipmentInterface.validateBulkShipment() and zkfedex.BulkShipmentInterface.processBulkShipment() return a String value representing the Batch ID. as each Queued Shipment gets processed, a Queued Shipment Status record gets inserted that will show the results (see the Status__c field) and also contain the Batch ID. After all Queued Shipments are processed, a Bulk Shipment Status record is inserted associated to the Bulk Shipment also with the Batch ID, just so you know the processing is complete. The Queued Shipment Status object and the Bulk Shipment Status object are useful for writing triggers. You can write triggers that execute logic as each Queued Shipment is processed for a given Batch ID, or you can write triggers that execute logic once an entire Bulk Shipment Status indicates that processing is done for all the queued shipments.

A key thing to note is that the master lookup field on the FedEx Queued Shipment object is re-parentable. This is so you can build different ways of handling failed validations or processing of a Bulk Shipment queue. For example, you can decide to perform the validation on a Bulk Shipment record, and if any Queued Shipment validations fail, those can be re-parented to a new Bulk Shipment record that can be a collection of Queued Shipments that need to be adjusted to pass validation. Also, the same can be done during the processing of the Queued Shipment records, where any Queued shipments that have an error can be re-parented to a new Bulk Shipment record that can be a collection of Queued Shipments that need to be evaluated by the users.

To test without building any of your own Apex code to integrate, you can use the Salesforce Developer Console. Note, you must first insert in valid data for Queued Shipments and Queued Packages. In the Salesforce Developer Console, simply execute the following once you have inserted in valid data (will perform actions on the Bulk Shipment record with the name ‘Bulk-Shipment-00000001’, adjust accordingly):

zkfedex__BulkShipment__c[] bulkShipments = [select Name,Id from zkfedex__BulkShipment__c];
zkfedex__BulkShipment__c bulkShipment = null;
for (zkfedex__BulkShipment__c bs : bulkShipments) {
  if (bs.Name == ‘Bulk-Shipment-00000001’) {
    bulkShipment = bs;
  }
}
//NOTE: switch the following call to processBulkShipment() to test that as a separate test
if (bulkShipment != null) {
  zkfedex.BulkShipmentInterface.validateBulkShipment(bulkShipment.Id, false);
}

Once a validate or processes bulk is kicked off, do not do any operations on the Bulk Shipment or Queued Shipment/Packages until the batch is done. You will know it is done for the entire batch once a Bulk Shipment Status record is inserted with the corresponding Batch ID

The Bulk Shipment Status record’s Status__c field simply indicates that the validate or process batch completed, but does not indicate whether the individual Queued Shipment‘s were validated/processed successfully. Check the Bulk Shipment Status object’s Status__c picklist field for possible values.

Each Queued Shipment record’s Queued Shipment Status record (of the same Batch ID) should be checked to identify errors or ensure success. Check the Queued Shipment Status object’s Status__c picklist field for possible values.

It is recommended that you first run the validateBulkShipment() method on the Bulk Shipment and verify the resulting Queued Shipment Status records before you attempt the processBulkShipment(). If the validation was successful, the Status__c field of all Queued Shipment Status records (for that Batch ID) should be set to VALIDATED

It is recommended that after a processBulkShipment(), that you verify the resulting Queued Shipment Status records. If the processing was successful, the Status__c field of all Queued Shipment Status records (for that Batch ID) should be set to SUCCESS

If the Status__c field for a Queued Shipment Status record is ever set to ERROR, the StatusMessage__c field on that Queued Shipment Status record will contain a message describing the error.

At a minimum, the following fields on the Queued Shipment record must have a value for a Domestic Shipments:

  1. Ship Date
  2. Dropoff Type
  3. Label Image Type – should be set to a Thermal printer option if you would like to use the bulk printing feature
  4. Service Type
  5. Packaging Type
  6. Weight/Dimension Units – Set to LB / IN for US domestic shipments
  7. Sender Details (Sender Name, Sender Company, Sender Phone, Sender Email, Sender Street, Sender City, Sender, State/Province, Sender Zip/Postal Code, Sender Country)
  8. Recipient Details (Recipient Name, Recipient Phone, Recipient Street, Recipient City, Recipient State/Province, Recipient Zip/Postal Code, Recipient Country)
  9. Payment Type
  10. Payor Account – if Payment Type not set to ‘Sender’
  11. Payor Account Country – if Payment Type not set to ‘Sender’

At a minimum the following fields on the Queued Package record must have a value for a Domestic Shipment:

  1. Declared/Carriage Value
  2. Weight

It is recommended you set the fields that associate the shipment to other objects. For example, if you want the Shipment record generated to have the lookup set to an Account object, ensure the field Account__c has a value set on the Queued Shipment record. If you want the Shipment record generated to have the lookup set to a Contact record, ensure the field Contact__c has a value set on the Queued Shipment record. If you want the Shipment record generated to have the lookup set to a Lead record, ensure the field Lead__c has a value set on the Queued Shipment record. If you want the Shipment record generated to have the lookup set to an Opportunity, ensure the field Opportunity__c has a value set on the Queued Shipment record. If you use a different record for the address information of the recipient, then you can specify a way to associate that custom object using the fields CustomAddressSource__c and CustomAddressSourceRecordId__c on the Queued Shipment record. Note, to use those relating to Custom Address Source, a valid Custom Address Source must be setup already. Please see field level documentation for more details.

It is recommended that once you process a Bulk Shipment and created all the labels, that you do not add more Queued Shipments to the Bulk Shipment and process it again, as that will re-processes Queued Shipments that were already part of the Bulk Shipment. The goal is to treat the Bulk Shipment as your queue, and validate it and update the Queued Shipment until all validations pass, and then process the Bulk Shipment once to generate labels just once.

It is recommended that if any Queued Shipments fail as part of the processing of a Bulk Shipment, that those Queued Shipments be re-parented to a new Bulk Shipment and updated and processed as part of the new Bulk Shipment.

Once a successful processing of a Bulk Shipment occurs, the individual Queued Shipment Status records will have a lookup to the Shipment record that was generated.

3. FedEx Bulk Shipping Fields

FedEx Bulk Shipment

FedEx Bulk Shipment Status

FedEx Queued Package

FedEx Queued Package Special Services

FedEx Queued Shipment

FedEx Queued Shipment Special Services

FedEx Queued Shipment Status

Did this answer your question?