I've asked a few times in here how to run a script...
# suitescript
e
I've asked a few times in here how to run a script when a Picking Ticket is printed, but haven't had much luck with responses. I finally compared the context when Printing a copy of the Sales Order VS. Printing a Picking Ticket and saw that the 'entryfromquerystring' contains 'pt=T' when printing a picking ticket. So here's a code snippet that can be used... hope it helps someone
Copy code
/**
 * @NScriptName 
 * @NApiVersion 2.1 
 * @NScriptType UserEventScript
 *
 * This script does something when a picking ticket is printed...
 *
 */
define([], function () {

    /**
     * @param context {Object}
     * @param context.type {UserEventType} Trigger type
     * @param context.form {Form} Current form
     *
     * @function beforeLoad
     */

    function beforeLoad(context) {
        if (context.type == context.UserEventTypes.PRINT) {
            var record = context.newRecord;
            var queryString = record.getValue({
                fieldId: 'entryformquerystring'
            });
            if (queryString.includes('pt=T')) {
                // Do something when a picking ticket is printed...
            }
        }

    }

    return {
        beforeLoad: beforeLoad
    }
});