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.

Alternate Account
In NRGship you can have multiple master FedEx accounts. New records are always created using the default account, but you can set to an alternate value by using the Account field in the FedEx_Ship table.

Future Ship Date
When a label is created, we pass the current date as the ship date. If you are going to create labels "early" for a future ship date then you can set field ShipDate in the FedEx_Ship table.

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.
You can also manually create a return using the standard integration method, but set a value for ReturnShipment_ReturnType with a value of Print, Email or Tag depending on the return type. Note that for a return shipment, you must also set a value for FedEx_Packages::ItemDescription. If requesting an Email tag, you can include additional instructions in field FedEx_Ship::SpecialServices_Returns_EmailOptionalMessage. For Tag returns, include FedEx_Ship::PickupDetail_ReadyDate, (Suggested to be the next business day) FedEx_Ship::PickupDetail_ReadyTime, FedEx_Ship::PickupDetail_LatestPickupTime and FedEx_Ship::PickupDetail_CourierInstructions. All returns can also include FedEx_Ship::RMA_Number, FedEx_Ship::RMA_RecipientLocationNumber and FedEx_Ship::RMA_Reason.


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

COD - Cash on Delivery
If you want to send a COD shipment you need to properly set value in the following fields:
SpecialServices_COD_CollectionAmount - Base amount of COD
SpecialServices_COD_CollectionType - Set one of the values per the value list
SpecialServices_COD_AddTransportationCharges - Set one of the values per the value list
SpecialServices_COD_AddTransportationChargesDetail_RateTypeBasis - Set one of the values per the value list
SpecialServices_COD_AddTransportationChargesDetail_ChargeBasis - Set one of the values per the value list
SpecialServices_COD_AddTransportationChargesDetail_ChargeBasisLeve - Set one of the values per the value listl
SpecialServices_COD_CODReturn_* - set to your return address

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]

Complex Printing
If you have multiple users with multiple output devices, you can control label output with finite control by setting several fields.
Label_ImageType - Laser|Zebra|Eltron
Output_IPNumber - If has a value, will override default value with given IP #
Output_Username - Username for thermal printer if IP
Output_Password - Password for thermal printer if IP
Output_WindowsPort - If has a value, will override default value with given port
Output_PrinterName - If has a value, will override default value with given printer name
Output_ShipAndPrint - If ship and print is disabled in prefs, set this value to 1 and it will ship & print
Output_PrintDialogs - If dialogs are disabled in prefs, set this value to 1 and dialogs will appear

Labels to PDF
NRGship does not have an option to print labels directly to PDF (or to email). In order to produce output to PDF you would need to use the NRGship preference to print with dialogs (and then the user would manually select PDF or email) or you could add some scripting to utilize the field Packages::_Labels_OutboundLabel on your own layout which would then use standard FileMaker scripting to print to PDF.

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.

Freight
Setting of additional fields is required for FedEx Freight shipments. The interface can be viewed by selecting Additional Options with a valid freight service. This will expose data required at the ship and package level that is not needed for parcel shipments. Fields specific to freight have a Freight_ prefix to their name. If you will be using FedEx Freight Direct options you will need to put the value BASIC or BASIC BY APPOINTMENT in the Freight_DeliveryInstructions field.
Ship Table:
Freight_Role
Freight_PaymentType
Freight_CollectTermsType
Freight_Comment
Freight_DeliveryInstructions
Freight_DeclaredValueUnits
Freight_DeclaredValuePerUnit
Freight_LiabilityCoverageAmount
Freight_LibabilityCoverageType
Freight_FedExFreightAccountNumber
Freight_SpecialServices
Freight_Billing_*
Package Table: (in additional to packaging, dims and weight)
Freight_Description
Freight_NMFC
Freight_Class
Freight_PurchaseOrderNumber
Freight_BOL_Number
Freight_Pieces (# of boxes on pallets)
Freight_HandlingUnits (# of pallets)

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.

International - Documents Only
You can automate a documents only shipment by setting the following fields:
Ship::International_Documents = "1"
Ship::International_PurposeOfShipment = "Not Sold"
Ship::International_TermsOfSale = "Delivered Duty Unpaid (DDU)"
International Commodity::NumberOfPieces = "1"
International Commodity::UnitPrice = "1"
International Commodity::Weight = "1"
International Commodity::QuantityUnits = "Pcs"
International Commodity::CustomsValue = "1"
International Commodity::Description = "Legal Documents"

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.