Mike Casey
01/15/2025, 9:09 PMCeligo AI
01/15/2025, 9:09 PMAI generated answer (using internal Slack threads):Based on the conversations, here is a sample SuiteScript 2.0 client script that will display a dialog box when a Sales Order is copied using the action dropdown in the UI. If the user clicks OK, the script continues to the new copy. If the user clicks Cancel, the creation of the copy is stopped.
javascript
/**
 * @NApiVersion 2.x
 * @NScriptType ClientScript
 */
define(['N/ui/dialog', 'N/currentRecord'], function(dialog, currentRecord) {
    function pageInit(scriptContext) {
        if (scriptContext.mode === 'copy') {
            dialog.confirm({
                title: 'Confirm',
                message: 'Are you sure you want to copy this Sales Order?'
            }).then(function(result) {
                if (!result) {
                    // If the user clicks Cancel, stop the creation of the copy
                    var record = currentRecord.get();
                    record.cancelLine({sublistId: 'item'});
                }
            });
        }
    }
    return {
        pageInit: pageInit
    };
});pageInitcancelLineCeligo AI
01/15/2025, 9:09 PMSlack thread 1: here (available only if the original thread was posted in the last 90 days)
Similarity score: 0.86364466
Slack thread 2: here (available only if the original thread was posted in the last 90 days)
Similarity score: 0.847966909
Slack thread 3: here (available only if the original thread was posted in the last 90 days)
Similarity score: 0.842260063
Celigo AI
01/15/2025, 9:09 PM