1. Home
  2. Docs
  3. Partners
  4. Financial Force
Log a Case

FinancialForce Shipping Integration

Zenkraft integrates with FinancialForce with just a few custom fields and a trigger. The guide below shows the steps necessary to set up the integration.

Separate out address lines

Zenkraft shipping applications require that the address fields are separated out by Street Address, City, State, Zip, and Country code. These fields have to be on the Shipping record itself, so we will use a set of formula/text fields to accomplish this. Go to Setup > Object Manger > Shipping and create a new formula field and add the formula fields as you see below:

Shipping Street


IF( ISBLANK( SCMC__Sales_Order__r.SCMC__Actual_Ship_To_Address__c ) , 
SCMC__Sales_Order__r.SCMC__Customer_Account__r.ShippingStreet,
SCMC__Sales_Order__r.SCMC__Actual_Ship_To_Address__r.SCMC__Mailing_Street__c)

Shipping Street 2


IF( ISBLANK( SCMC__Sales_Order__r.SCMC__Actual_Ship_To_Address__r.SCMC__Mailing_Street_Additional_Information__c ) , '', 
SCMC__Sales_Order__r.SCMC__Actual_Ship_To_Address__r.SCMC__Mailing_Street_Additional_Information__c ) +
IF( ISBLANK( SCMC__Sales_Order__r.SCMC__Actual_Ship_To_Address__r.SCMC__Building_Information__c ) , '',
SCMC__Sales_Order__r.SCMC__Actual_Ship_To_Address__r.SCMC__Building_Information__c)

Shipping City


IF( ISBLANK( SCMC__Sales_Order__r.SCMC__Actual_Ship_To_Address__c ) , 
SCMC__Sales_Order__r.SCMC__Customer_Account__r.ShippingCity,
SCMC__Sales_Order__r.SCMC__Actual_Ship_To_Address__r.SCMC__Mailing_City__c)

Shipping State


IF( ISBLANK( SCMC__Sales_Order__r.SCMC__Actual_Ship_To_Address__c ) , 
SCMC__Sales_Order__r.SCMC__Customer_Account__r.ShippingState,
SCMC__Sales_Order__r.SCMC__Actual_Ship_To_Address__r.SCMC__Mailing_State_Province__c)

Shipping Postal Code


IF( ISBLANK( SCMC__Sales_Order__r.SCMC__Actual_Ship_To_Address__c ) , 
SCMC__Sales_Order__r.SCMC__Customer_Account__r.ShippingPostalCode,
SCMC__Sales_Order__r.SCMC__Actual_Ship_To_Address__r.SCMC__Mailing_Zip_Postal_Code__c)

Shipping Country


IF( ISBLANK( SCMC__Sales_Order__r.SCMC__Actual_Ship_To_Address__c ) , 
SCMC__Sales_Order__r.SCMC__Customer_Account__r.ShippingCountry,
SCMC__Sales_Order__r.SCMC__Actual_Ship_To_Address__r.SCMC__Mailing_Country__c)

Create a Custom Address Source based on your Formula Fields

You can now map your new FinancialForce address fields into the shipping wizard using a custom address source.

Follow the Custom Address Source tutorials to finish the integration:

Multi-Carrier Custom Address Source Integration

Add Trigger to Package Object

Use the trigger below to update the FinancialForce shipment object so that the Number Of Boxed and Total Weight are set correctly.


trigger UpdateTotalWeightAndPackageCount on zkmulti__Package__c (after insert) {
// Lists to update
List<zkmulti__Shipment__c> shipmentsToUpdateList = new List<zkmulti__Shipment__c>();
List<SCMC__Shipping__c> ffShipmentsToUpdateList = new List<SCMC__Shipping__c>();
// Get current shipments based on packages
Set<Id> allShipmentsIdsSet = new Set<Id>();
for (zkmulti__Package__c pkg : Trigger.new) {
allShipmentsIdsSet.add(pkg.zkmulti__Shipment__c);
}
Map<Id, zkmulti__Shipment__c> shipmentsMap = new Map<Id, zkmulti__Shipment__c>([
SELECT Total_weight_of_all_packages__c,
Total_number_of_packages__c,
Shipping__c
FROM zkmulti__Shipment__c
WHERE Id IN :allShipmentsIdsSet
LIMIT 50000]);
// Update shipments with new packages
for (zkmulti__Package__c pkg : Trigger.new) {
if (shipmentsMap.containsKey(pkg.zkmulti__Shipment__c)) {
shipmentsMap.get(pkg.zkmulti__Shipment__c).zkmulti__ModKey__c = '<CONTACT ZENKRAFT SUPPORT FOR THIS KEY>';
shipmentsMap.get(pkg.zkmulti__Shipment__c).Total_number_of_packages__c = shipmentsMap.get(pkg.zkmulti__Shipment__c).Total_number_of_packages__c + 1;
shipmentsMap.get(pkg.zkmulti__Shipment__c).Total_weight_of_all_packages__c += pkg.zkmulti__Weight__c;
shipmentsToUpdateList.add(shipmentsMap.get(pkg.zkmulti__Shipment__c));
}
}
update shipmentsToUpdateList;
// Get FF shipments
Map<Id, zkmulti__Shipment__c> ffShipmentToShipmentMap = new Map<Id, zkmulti__Shipment__c>();
for (zkmulti__Shipment__c shipment : shipmentsToUpdateList) {
ffShipmentToShipmentMap.put(shipment.Shipping__c, shipment);
}
Map<Id, SCMC__Shipping__c> ffShipmentsMap = new Map<Id, SCMC__Shipping__c>([
SELECT SCMC__Number_of_Boxes__c,
SCMC__Weight__c
FROM SCMC__Shipping__c
WHERE Id IN :ffShipmentToShipmentMap.keySet()
LIMIT 50000]);
// Update FF shipments
for (SCMC__Shipping__c ffShipment : ffShipmentsMap.values()) {
ffShipment.SCMC__Number_of_Boxes__c = ffShipmentToShipmentMap.get(ffShipment.Id).Total_number_of_packages__c;
ffShipment.SCMC__Weight__c = ffShipmentToShipmentMap.get(ffShipment.Id).Total_weight_of_all_packages__c;
ffShipmentsToUpdateList.add(ffShipment);
}
update ffShipmentsToUpdateList;
}

Test

Now it is time for you to test.

If you have any queries then please contact us and we will be happy to help