How to Use a Smart Document as an Order Assembly Guide

This is a step-by-step guide for how to customize an order assembly guide document using smart documents and scripts

Step 1: Go to Smart Documents 

  • Create a new smart document, label it something related to Order Assembly Guide Customized

  • Set Record Type to Fulfillment Process

  • Set API Version to Beta

  • Use the script example directly below and insert it into the text box under the drop-down options using the <> tool

    • You will need to click on the <> (source code) icon in the Code Editor and then insert the code example given below. 


Pro Tip: This specific script is designed to help customize the Cartonization for the Order Assembly Guide. If you do not want that customization included, you will need to delete those parts of the script below. You can fully customize this script to perform the exact customization you are looking for. 


Step 2: Go to Script Table and Create a New Script

  • Name the Script something detailed that will help you know what action the script is performing

  • Select Smart Document from the Script Type drop-down

  • Some general information will populate in the Code box, you can delete this if you want and enter in the script below

  • Click Save

Pro Tip: This Script is customized specifically for cartonization. You can delete this action from the script and personalize it for what your particular needs are for the Order Assembly Guide. 

 

 

Step 3: Navigate back to the Smart Documents Template Table

  • Find the Smart Document you created in step 1

  • Click Edit on the Smart Document

  • Navigate to the Script drop-down

  • Select the script you created in Step Two

  • Save 


Step 4: Test the Order Assembly Guide Customizations by running a Fulfillment Process and seeing if the customizations you added are performed 



Use Case: Use a Script to Pull Different Records than the Script Record Type

You can add a loop to a script to pull dynamic information into your smart document so you do not have to look this information up manually. 

Use Case for Order Assembly Guides:

Sometimes you might want to pull different values into your Smart Document but you have to populate them from another script, such as the Fulfillment Process script. In this example, we want Order Records to pull the Order Source ID and Name from the Fulfillment Process Script for the Order Assembly Guide Smart Document. 

Script Example:

utils.log("Verify order to see what shows here" + order.processNo + ".");

for(var i=0; i<orderList.size(); i++)

{

var order = orderList.get(i);

utils.log("Order Id: " + order.orderNo);

var sourceId = order.orderSourceId;

utils.log("Found order source Id: " + sourceId + ".");

var sourceSearch = infoplusApi.getById("orderSource", sourceId);

var sourceName = sourceSearch.name;

utils.log("Got order source name: " + sourceName + ".");

output.put("sourceName", sourceName);

}