Users can access a script within a custom email template to pull in necessary data. In the example below, our client created a custom email template that could be sent out from an ASN record within Infoplus. They needed a script to dow two things: first, it grabs the contact information from the associated vendor record. Next, it pulls in data (item category for example) that can then be used in the body of the email. 

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.

// get vendor object
var vendor = infoplusApi.getById("Vendor", asn.vendorId);
output.put("vendor", vendor);

// query for all items on asn and put into map
var skuList = [];
for(var i=0; i<asn.lineItems.size(); i++)

var filter = "sku in ('" + skuList.join("','") + "')";
utils.log("Searching for items with [" + filter + "]");
var itemList ="item", filter, null, 250, null);

var itemMap = {};
for(var i=0; i<itemList.size(); i++)
    var item = itemList.get(i);
    var itemCategory ="itemCategory", "internalId eq '" + 
    item.majorGroupId + "'", null, 1, null).get(0);
    utils.log("Found item [" + item.sku + "] with item category of [" + + "]");
    itemMap["sku_"+item.sku] = item;
    itemMap["cat_"+item.sku] =;

output.put("itemMap", itemMap);

You can add the script to the custom email template and then utilize $!{scriptOutput.xxxx}. The '!' will only add a value if it finds one and prevent errors.