UNEXPECTED ERROR

Trying to create a script record but I get this error:

Failed to evaluate script: {“type”:”error.SuiteScriptModuleLoaderError”,”name”:”UNEXPECTED_ERROR”,”message”:”missing variable name (SS_SCRIPT_FOR_METADATA#14)”,”stack”:[]}

/**
 *@NApiVersion 2.x
 *@NScriptType ClientScript
 */
define([‘N/record’, ‘N/currentRecord’, ‘N/search’, ‘N/url’, ‘./JSPMStatus.js’, ‘./JSPrintManager.js’],
    function (record, currentRecord, search, url, JSPMStatus, JSPrintManager) {
        var quantity = ”;
        var dataInicio = ”;
        var tranID = ”;
        var lineFeed = “\x0A”;
        var cmds = ”;
        const;
        JSPM.JSPrintManager.auto_reconnect = true;
        JSPM.JSPrintManager.start();
        JSPM.JSPrintManager.WS.onStatusChanged = function () {
        };
        function JSPMStatus() {
            if (JSPM.JSPrintManager.websocket_status == JSPM.WSStatus.Open)
                return true;
            else if (JSPM.JSPrintManager.websocket_status == JSPM.WSStatus.Closed) {
                alert(‘JSPrintManager (JSPM) is not installed or not running! Download JSPM Client App from https://neodynamic.com/downloads/jspm’);
                return false;
            } else if (JSPM.JSPrintManager.websocket_status == JSPM.WSStatus.BlackListed) {
                alert(‘JSPM has blacklisted this website!’);
                return false;
            }
        }
        function print(o) {
            try {
                if (JSPMStatus()) {
                    //Create a ClientPrintJob
                    var cpj = new JSPM.ClientPrintJob()
                    cpj.clientPrinter = new JSPM.DefaultPrinter()
                    var recordPrint = currentRecord.get()
                    var id = recordPrint.getValue({
                        fieldId: ‘custpage_numero_pedido_trabalho’
                    });
                    var workOrder = record.load({
                        type: ‘workorder’,
                        id: id,
                        isDynamic: true
                    });
                    dataInicio = workOrder.getValue({
                        fieldId: ‘startdate’
                    });
                    tranID = workOrder.getValue({
                        fieldId: ‘tranid’
                    })
                    var suiteletURL = url.resolveScript({
                        scriptId: ‘customscript_rsc_sl_etiqueta_caixa_indiv’,
                        deploymentId: ‘customdeploy_rsc_sl_etiqueta_caixa_indiv’
                    });
                    //Set content to print…
                    //Create Zebra EPL commands for sample label
                    cmds += lineFeed;
                    cmds += ‘CT~~CD,~CC^~CT~’;
                    cmds += lineFeed;
                    cmds += ‘^XA~TA000~JSN^LT0^MNW^MTD^PON^PMN^LH0,0^JMA^PR6,6~SD29^JUS^LRN^CI0^XZ~DG000.GRF,01280,020,:::::::::O070I07F0K07F01FJFC0I070,N03F8007FFE80I0HF81FJFC0H03F0,N0HFI0JF80H01FF01FJFC0H0HF0,M0HFE003FA3F80H03FE03FJF800FFE0,L03FFE001F007C0H07FE0J07C003FFE0,K01FHFE003F00FC003FFE0J0F801FHFE0,K01FCFC001F00FC007F7C0I01F001FCFC0,K03E0F8003F83F800FEFE0I0FE003E0F80,K0101F80H07FFE001F0FC0H01FC00101F80,M03F80H0IF8007F0F80H03F80I03F80,M01F0H03FHFC00FC1F80H07F0J01F,M03F800FE07F03F83F80H0FE0J03F80,M03F001FC03F03F01F0I0FC0J03F,M07E003F803F8FKF801F80J07E,M07E001F003F0FKFH01F0K07E,M0FE003F807F0FKFH03F0K0FE,M07C001FC07E0I07E0H07E0K07C,M0FE0H0JFC0I0FE0H0FE0K0FE,L01FC0H07FHFK0FC0H0FC0J01FC,L01F80I0BF80J0FC0H0F80J01F8,,:::::::::::::::::::::::::::::::::’;
                    cmds += lineFeed;
                    cmds += ‘^XA’;
                    cmds += lineFeed;
                    cmds += ‘^MMT’;
                    cmds += lineFeed;
                    cmds += ‘^PW320’;
                    cmds += lineFeed;
                    cmds += ‘^LL0102’;
                    cmds += lineFeed;
                    cmds += ‘^LS0’;
                    cmds += lineFeed;
                    cmds += ‘^FT96,64^XG000.GRF,1,1^FS’;
                    cmds += lineFeed;
                    cmds += ‘^FT13,45^A0N,25,52^FH\^FD’ + tranID + ‘^FS’;
                    cmds += lineFeed;
                    cmds += ‘^FT16,70^A0N,25,52^FH\^FD’ + dataInicio + ‘^FS’;
                    cmds += lineFeed;
                    cmds += ‘^PQ1,0,1,Y^XZ’;
                    cmds += lineFeed;
                    cmds += ‘^XA^ID000.GRF^FS^XZ’;
                    cpj.printerCommands = cmds
                    //Send print job to printer!
                    cpj.sendToClient()
                    setTimeout(function () {
                        window.location.href = suiteletURL;
                    }, 4000);
                }
            }
            catch (error) {
                console.log(“cagou”, error)
            }
        }
        function fieldChanged(context) {
            var currentRecord = context.currentRecord
            var tipo = context.fieldId
            try {
                if (tipo === ‘custpage_numero_pedido_trabalho’) {
                    var id = currentRecord.getValue({
                        fieldId: ‘custpage_numero_pedido_trabalho’
                    });
                    var workOrder = record.load({
                        type: ‘workorder’,
                        id: id,
                        isDynamic: true
                    });
                    tranID = workOrder.getValue({
                        field: ‘tranid’
                    })
                    quantity = workOrder.getValue({
                        fieldId: ‘quantity’,
                    })
                    currentRecord.setValue({
                        fieldId: ‘quantity’,
                        value: quantity
                    });
                    currentRecord.setValue({
                        fieldId: ‘tranid’,
                        value: tranID
                    })
                }
            } catch (error) {
                log.error(‘erro’, error)
            }
        }
        return {
            fieldChanged: fieldChanged,
            print: print
        }
    });
 

 

Rookie Asked on February 24, 2022 in SuiteScript.
Add Comment
1 Answer(s)

what’s with all the div tags?

Rookie Answered on February 24, 2022.

I do not know. I selected the code block and put the code inside. It was so

on February 25, 2022.
Add Comment

Your Answer

By posting your answer, you agree to the privacy policy and terms of service.
  • This site made possible by our sponsors:   Tipalti   Celigo   Limebox   Become a Sponsor