When we save the Packing Slip the screen jumps back into the SRA form.

Requirements:

When we save the Packing Slip the screen jumps back into the SRA form.  I had to go back into the PS to print it. Please change this to display the packing slip page upon saving.

Solution:

When we save the Packing Slip, the screen jumps back into the SRA form: As per NetSuite standard behavior, the screen navigates back into the SRA form. We could change this to display the packing slip page upon saving using Script.

User Event Script :

The purpose of the user event script is after saving the packing slip, the screen will not jump into the SRA. It stayed on the packing slip.    

/**
 * @NApiVersion 2.1
 * @NScriptType UserEventScript
 */
define(['N/record', 'N/redirect'],
    /**
 * @param{record} record
 * @param{redirect} redirect
 */
    (record, redirect) =>
    {
        /**
         * Defines the function definition that is executed after record is submitted.
         * @param {Object} scriptContext
         * @param {Record} scriptContext.newRecord - New record
         * @param {Record} scriptContext.oldRecord - Old record
         * @param {string} scriptContext.type - Trigger type; use values from the context.UserEventType enum
         * @since 2015.2
         */
        const afterSubmit = (scriptContext) =>
        {
            try
            {
                let newRecord = scriptContext.newRecord;
                let internalID = newRecord.getValue({fieldId:"id"});
                log.debug({title:"Internal ID",details:internalID});
                redirect.toRecord({
                    type: record.Type.ITEM_FULFILLMENT,
                    id: internalID
                });
            }
            catch  (e)
            {
                log.debug({title: 'error in afterSubmit', details: e});
            }
        }
        return {afterSubmit}
    });

Leave a comment

Your email address will not be published. Required fields are marked *