RE: Syntax error: missing ; before statement

When I upload the following code I get the error “Syntax error: missing ; before statement”

 

/**
 * @NApiVersion 2.x
 * @NScriptType UserEventScript
 */
define([‘N/record’, ‘N/log’, ‘N/search’ ], function(record, log) {
    function beforeLoad(context) {
        //Log our enteties
        if(context.type === context.UserEventType.VIEW){
            var fulfillmentRecordID = context.newRecord.id;
            log.debug(“Fulfillment Id”,fulfillmentRecordID);
            const inventoryDetailSearchFilters: SavedSearchFilters = [
                [‘pickcarton’, ‘isnotempty’, ”],
                ‘AND’,
                [‘transaction.internalid’, ‘anyof’, ‘6327795’],
            ];
            const inventoryDetailSearchColPickCarton = search.createColumn({ name: ‘pickcarton’ });
            const inventoryDetailSearch = search.create({
                type: ‘inventorydetail’,
                filters: inventoryDetailSearchFilters,
                columns: [
                    inventoryDetailSearchColPickCarton,
                ],
            });
            log.debug(inventoryDetailSearch);
        }
    };
    return {
        beforeLoad: beforeLoad
    };
});

 

I am trying to build a saved search to pull the carton field from the Item Fulfillment Record’s Line Item Inventory Detail. I then will be taking the list of cartons and making the unique values and putting them in a field in the Header.

RedHeadHunt Beginner Asked on December 27, 2023 in SuiteScript.
Add Comment
2 Answers

I strongly suspect the use of const requires SuiteScript 2.1 – just change 2.x to 2.1 at the top of the script.

Advanced Answered on December 27, 2023.
Add Comment

Your Answer

By posting your answer, you agree to the privacy policy and terms of service.