This article will describe how an Infoplus user can use a script and trigger combination to automatically add parcel accessories for orders.
You can add accessories like:
- Adult Signature required
- Signature required
- No Signature required
- Hold For Pickup
In this particular example, we will explore adding Signature Required.
You may want to utilize the Infoplus API reference page to get the field names in question. (make sure you are using the beta (our edge) version of the API) http://developer.infopluscommerce.com/api/reference/beta/#!/order/addOrder
Due to the ever-changing nature of writing and maintaining scripts, Infoplus does not provide support in this area. We recommend someone in your IT Department handles scripting requests internally so that you keep all control over the process.
Step 1: Navigate to the Script table and select the Create New button.
Step 2: Enter a name for the script, select Record as Script Type, Order as Record Type and again make sure you are using the Beta API Version.
Step 3: The code to make this happen is very simple.
Step 4: Now that we have the script created, we can setup a Trigger to automatically run it on the orders we want. In this example, we will update all orders that enter the system. To accomplish this we will navigate to the order table and create a smart filter for any order in the 'Pending' status (orders are briefly in a pending status when they first enter the system). By creating a filter on this pending status we will be able to update all of the orders before they are in an 'On Order' status.
Note: you can apply additional filters if you want to specify what kind of orders this script should be applies to, ie. certain lines of business, carriers, ship to states etc. etc.
Step 5: Now that you have the script and a pending smart filter created, it is time to create the trigger that will automatically run the script. Navigate to the Trigger table and select Create New.
Step 6: Give the trigger an appropriate name and description. Next, select the pending smart filter that was created and make sure the trigger is active. Since we want to run this script on any new orders entering the system, we will choose the Insert event option. (The update option would run the script anytime and order is updated to meet the smart filter criteria.)
Step 7: Now that the trigger is created, we will want to give it an 'action' to take. Select the actions icon bubble to see the full menu of available actions. In this scenario we will want to select 'run script' and choose the Parcel Reference Mapper script. (note that you can stack actions on top of each other for a single trigger)
Once you hit save, the trigger is in place and the next order that enters the system should get updated. You can check your script by looking at your Script Log table once some orders have dropped in.
Here are the Parcel Accessories you can specify for Orders:
|ADSIG||Adult Signature Required|
|HLDPK||Hold For Pickup|
|SHREL||No Signature Required|
|INSUR||Insurance for the Order. Note: You will also need to set the 'amount' variable in the script to reflect the amount of required insurance. See example below.|
Accessory Identifier Accessory Note:
Here is an example script to add insurance (which requires the amount):