The ShipHawk SuiteApp has the ability to sync orders instantly to ShipHawk when certain user events occur. Many customers do not have any user events triggered to sync orders to ShipHawk. This document explains how to customize our Map/Reduce saved search to allow customers to control which orders get synced to ShipHawk.
Recent Un-Synced Orders
When the ShipHawk bundle/SuiteApp is installed, a map/reduce script is also installed. The function of this script is to run on a schedule to sync orders to ShipHawk. This script only syncs orders that have met the correct status, but have also not executed the event scripts. This document covers each piece of this script, and explains the end-to-end process.
Saved Search
ShipHawk determines which orders meet the criteria to be synced by running a saved search. The saved search is installed with the bundle installation. The name of the saved search is Recent Un-synced Orders and the ID is customsearch_shiphawk_recent_unsynced_so.
The criteria for this saved search is as follows:
Type: Sales Order.
ShipHawk Sales Order Sync: ShipHawk Order NBR is EMPTY (signifies it has not synced to ShipHawk).
Date Created is After yesterday.
Date Created is before 5 minutes ago.
Status: Sales Order Pending Fulfillment.
The saved search is executed and runs every 15-minutes. The Map/Reduce Script is what triggers/fires the saved search.
Map/Reduce Script
The Map/Reduce script is a scheduled script. It runs every day in 15-minute intervals.
The name of the script is Link Unsynced Sales Order Map/Reduce. The ID of the script is customdeploy_shiphawk_sync_unsyncedso_mr.
How the script works:
The script runs every 15-minutes.
The script triggers the Recent Un-synced orders saved search and parses the results.
Any order that is at least 5-minutes old is synced to ShipHawk.
If an order is found to meet all criteria for the script, the ShipHawk Sales Order Event Script is executed to sync the order to ShipHawk.
Customizations
Occasionally, customers may have different criteria to sync orders to ShipHawk. These could include any number of things, but we will use the following example:
One ShipHawk customer only syncs orders to ShipHawk which have the Ready to Ship flag selected.
This customer performs edits to their sales order to set this flag, which does not trigger event scripts.
We can adjust the Recent Un-Synced Orders saved search criteria to match their use case by adding the Ready to Ship == True to the current list of criteria.
This will now only pull orders in our saved search which meet their criteria.
You can edit the saved search to accomplish a number of tasks. It is highly suggested to preview the search before saving to ensure the proper data is returned in the results.