Integration»Adding Complex Features

Adding Complex Features

Adding Complex Features

While the walkthru provides a simple overview of creating and shipping records in NRGship, it is likely that you may need to create complex shipments which include third-party/recipient billing and/or international shipping. By adding additional logic to your scripting you can easily add support for complex shipments.

Third Party/Bill Recipient/Consignee
Often the recipient will want to bill shipping on an alternate account. In order to facilitate this type of shipping, set the following fields in the FedEX_Ship table:
Payment_Payor_PayorType [Sender|Recipient|Third Party|Collect]
Payment_Payor_AccountNumber
Payment_Payor_CountryCode

Multiple Packages
If you have package data in your solution, you can easily create additional related records in the FedEx_Packages table. Rather than the 1:1 relationship from the Basic integration, a more complex script could be utilized to create additional records in the FedEx_Packages table by setting the value of FedEx_Packages::Ship_ID to the value from FedEx_Ship::Ship_ID

For example, in your ship script, after you create a record in FedEx_Ship you could set a variable $ship_id to the incremental FedEx_Ship::Ship_ID. When you are ready to create packages you can switch over to a layout based on FedEx_Packages. For each package, create a new record and set the FedEx_Packages::Ship_ID value to the variable $ship_id. Next, set all of the package values like weight, dimensions and reference number. Remember to commit the record after setting these values.


Multiple Shipments
If you would like to do multiple shipments from a CRM system (ex: Contacts) or invoice database then you will likely want to create an interim "join" table between your table and the NRG tables.
Simply create a new record in the join table and then create your related record in FedEx_Ship based on this ID instead of the primary key in your contacts or invoice table.

Return Shipments
Return shipments can be created easily by using the External - Create Return Shipment and Show Ship ID script. Simply create a new shipment record and pass the Ship_ID or pass in the Ship_ID of an existing shipped record and the record will be converted to a return shipment and then displayed to the shipper for label generation.


Drop Shipments
You may want to create shipments that have an address displayed on the label that is different from the actual sending location. In order to facilitate these shipments, you will need to set values in these fields in the FedEx_Ship table:
# These are the fields which will appear on the printed label
Label_DisplayedOrigin_Contact_CompanyName
Label_DisplayedOrigin_Contact_PersonName
Label_DisplayedOrigin_Address_Line1
Label_DisplayedOrigin_Address_Line2
Label_DisplayedOrigin_Address_City
Label_DisplayedOrigin_Address_StateOrProvinceCode
Label_DisplayedOrigin_Address_PostalCode
Label_DisplayedOrigin_Address_CountryCode
Label_DisplayedOrigin_Contact_PhoneNumber


Rate/Ship from Alternate Locations
You may want to rate or create shipments that come from an address that is different from the address displayed on the label, for example if you're providing a label to a drop shipper. You will want to use the Drop Shipper fields in addition so that the address printed on the label shows your origin. In order to facilitate these shipments, you will need to set values in these fields in the FedEx_Ship table:
# These are the fields which will be used for rating and shipping origin
Origin_Contact_CompanyName
Origin_Contact_PersonName
Origin_Address_Line1
Origin_Address_Line2
Origin_Address_City
Origin_Address_StateOrProvinceCode
Origin_Address_PostalCode
Origin_Address_CountryCode
Origin_Contact_PhoneNumber

Email Notifications
By setting a valid email address in Destination_Contact_EmailAddress and SpecialServices_EmailNotification_Recipient_ShipAlert to 1 then the information will be passed to FedEx for automated notifications at the time of shipment.

It may be preferred to take the post-ship _Tracking_TrackingNumber value and send out notifications from your own database so that you can include supplemental order information.

Delivery Confirmation
Fedex Provides four delivery confirmation options. Set the field according to your choice of the 4 options:
SpecialServices_SignatureOption [Deliver Without Signature|Indirect|Direct|Adult]

SmartPost Shipments
Values for SmartPost shipments are set from defaults in preferences, but can be overridden thru user scripts. The following fields can be modified as needed on a per-shipment basis. See value list for a listing of valid options for each field.
SmartPostDetail_Indicia.t
SmartPostDetail_AncillaryEndorsement.t
SmartPostDetail_CustomerManifestID.t - Customer value that shows on SmartPost billing.
SmartPostDetail_HubId.t - HubID for the shipment.

International Shipments
NRGship provides the ability to produce printed commercial invoices. In order to populate the line items for a commercial invoice, you will need to create a relationship from FedEx_Ship to International_Commodity based on FedEx_Ship::__pk_Ship_ID to FedEx_International_Commodity::__fk_Ship_ID. In the International_Commodity table, you will want to populate the following fields:
NumberOfPieces (Quantity)
UnitPrice
Weight
QuantityUnits (Normally Pcs)
CustomsValue
PartNum
Description
HarmonizedCode
CountryOfManufacture


In addition to the basic ship values you may also need to populate additional fields in the FedEx_Ship table:
International_Broker_AccountNumber
International_Broker_Address_City
International_Broker_Address_CountryCode
International_Broker_Address_Line1
International_Broker_Address_Line2
International_Broker_Address_PostalCode
International_Broker_Address_StateOrProvinceCode
International_Broker_Contact_CompanyName
International_Broker_Contact_EMailAddress
International_Broker_Contact_FaxNumber
International_Broker_Contact_PersonName
International_Broker_Contact_PhoneNumber
International_Broker_TIN
International_CountryOfUltimateDestination
International_CS_Comment1
International_CS_Comment2
International_CS_Comment3
International_CS_Freight
International_CS_Freight
International_CS_Insurance
International_CS_Insurance
International_CS_Other
International_CS_Other
International_Documents (Set to 1 if Documents Only)
International_DutiesPayment_DutiesPayor_AccountNumber
International_DutiesPayment_DutiesPayor_CountryCode International_DutiesPayment_PayorType [Sender|Recipient|Third Party|Collect]
International_NAFTA
International_PurposeOfShipment
International_RecipientTIN
International_SED_AESOrFTSRExemptionNumber
International_SED_SenderTINOrDUNS
International_SED_SenderTINorDUNSType
International_TermsOfSale
International_TotalCustomsValue
International_TotalShipmentWeight

Please consult the International layout for the fields to populate when using NAFTA, CO or SED.

Pickup Request
You can automate pickup requests by creating a record in the FedEx_PickupRequest table. Once a record is created, you can then pass the __kp__PickupRequest_ID value to one of the external scripts to create or cancel a pickup request. You will need to set all of the PickupLocation fields along with PackageCount and TotalWeight.