Pop up showing On Status Change

The client needs to show a popup when the shipping status is changed.

unction fieldChanged(scriptContext) {
            try {

                let currentRec = scriptContext.currentRecord
                let shippingNote = currentRec.getValue("custbody6")


                let createdFrom = currentRec.getValue({
                    fieldId: 'createdfrom'
                });

              let salesorderSearchObj = search.create({
                    type: "salesorder",
                    filters:
                    [
                       ["type","anyof","SalesOrd"], 
                       "AND", 
                       ["internalidnumber","equalto",createdFrom], 
                       "AND", 
                       ["mainline","is","T"]
                    ],
      columns:
                    [
                       search.createColumn({name: "internalid", label: "Internal ID"})
                    ]
                 });
                 let searchResultCount = salesorderSearchObj.runPaged().count;
if(searchResultCount>0){
                    if (checkForParameter(shippingNote)) {
                        if (scriptContext.fieldId === 'shipstatus') {
    
                            if (currentRec.getValue({ fieldId: 'shipstatus' }) === 'C') {
                                let options = {
title: 'Shipping Note',
                                    message: '<span style="color: red; font-weight: bold;font-size: 20px;">' + shippingNote + '</span>',
                                };
                                dialog.alert(options)
                            }
 }
                    }
                 }


            }
            catch (err) {
               log.error("error@fieldChanged", err)
            }
        }

Leave a comment

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