1. Home
  2. Docs
  3. Multi
  4. Integration Financialforce
Log a Case

FinancialForce

FinancialForce Shipping Integration

FinancialForce SCM tool has a natural place for Zenkraft to integrate; the Shipping object. This object contains the shipping address information as well as fields available to be updated with tracking numbers, ship date, total weight, number of packages, and service type.

Aside from the standard directions for setting up the application LINK, the Zenkraft & FinancialForce integration has two parts. First, the address fields and contact details all need to be on the Shipping object. Second, after a shipment is created, fields need to be moved from the Zenkraft Shipment record, up to the FinancialForce Shipping record.

Step 1. 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. From the setup menu > create > objects > shipping object > create new field. Here are some examples:

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)

Step 2. Create Custom Address Source

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

Multi-carrier Custom Address Source

Step 3. Add Trigger to Package Object

Use the trigger below to update the FinancialForce shipment object with the shipping fields shown below:

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;
}