Use a custom script to put orders in a pending state so they will not get fulfilled until another validation process runs externally.
If you have a situation where you want all of your orders to come into Infoplus, but to be placed on hold, so that they will not be released for fulfillment and shipping until after some validation takes place in an external system, you can build a workflow like this using the Infoplus API and Triggers in Infoplus.
High-Level Workflow
1. Get your Orders into Infoplus (whether that's via an API call, from a shopping cart connection, bulk load, etc).
2. Put Orders on hold in Infoplus with a Trigger and Script that also notifies your external system to validate the order.
3. If your external system needs to modify any data on the Order in Infoplus, do that with a call to the Infoplus API.
4. If the order is ready to ship, modify the Order in Infoplus with an API call. Or, if the order should never ship, you can delete it from Infoplus, or leave it on hold, possibly setting a tag or other data on the order to help you.
Sample Scenario
Imagine you have orders coming from a frontend system that does not perform address validation. You want to be aware of orders that have an invalid address, and you want to correct those addresses in a single system (a piece of middleware that has access to both the frontend system and Infoplus through APIs). Then have the corrected address pushed to both Infoplus and the frontend system.
To apply this recipe to that scenario, you would start by connecting the frontend system to Infoplus, typically through an Infoplus API connection that would POST to the Order endpoint. This gets all of your orders from the frontend into Infoplus.
Next, you would have setup in Infoplus a Smart Filter on the Orders table to identify orders from this order source that are in the status = Pending (i.e., newly created orders). Then you create a Trigger in Infoplus based on that Smart Filter, with an action that runs a Script against these orders and does the following:
- Update the order, setting the holdCode field to the value "H" (this will prevent the orders from running through fulfillment).
- Put a tag on the order, such as "pending-validation" (to give you an easy way to see which orders are currently in this status).
- Make a webhook call to your middleware system, notifying it that this order is in Infoplus, and is ready to be validated.
- You may choose to include all relevant data from the order in this call (e.g., the Infoplus Order No, the Frontend's Order No (e.g., Customer Order No in Infoplus), the ship-to address (Street 1, Street 2, City, State, Zip).
- Alternatively, you might just send the Infoplus Order No, and then within the middleware make a call back into the Infoplus API to fetch the order details.
See the sample script at the end of this article for an example of how this could be implemented as an Infoplus Script.
Then, in your middleware system, perform the validation that you need on the order that you were notified about. If you see that there is data on the order that needs updated (e.g., an address correction), your middleware pushes that updated data to the order in both Infoplus (through a PUT to the Order endpoint) and the frontend system (using its API).
If the order is now ready to be fulfilled, you would also want to reset the holdCode value on the order in Infoplus to "N", and remove the tag "pending-validation" tag that you previously placed on the order. You may also want to post an audit against the order in Infoplus, with any details from your middleware.
Variations
Instead of using a tag to track orders in this status, you could instead create a Custom Field, and push updates to that field to track this status.
Note that if you want your orders to Ship Complete in Infoplus, then the holdCode field for validated orders would need set to "Y" (which is required for orders with a Ship Complete value of True).
You could potentially avoid the trigger in Infoplus if the original post of your order to Infoplus included setting holdCode=H and then also posted that order to your middleware. You could also post a custom field value in this case to track your orders in this status, or make a follow-up call to the Infoplus API to tag the order after it is created.
Sample Script
The following script can be used as a blueprint or starting point for the script described above, to run via a Trigger in Infoplus against new orders, to put them on hold, tag them, and send them your middleware.