When I try and upload the below script I get a `mi...
# suitescript
p
When I try and upload the below script I get a
missing ; after-for-loop initializer
but I don't see how to fix this. The script works fine in console.
Copy code
function pageInit(context){
var showName = rec.getValue({
fieldId: 'custbody_show_name'
});

var mySearch = search.create({
   type: "customrecord506",
   filters:
   [
      ["custrecord254","anyof",showName]
   ],
   columns:
   [
      search.createColumn({name: "custrecord255"}),
   ]
});

var result = mySearch.run().getRange(0, 1000);
var searchResultCount = mySearch.runPaged().count;
if (searchResultCount > 0) {
            var item = new Array();
            var w;
            for (var i = 0; i < result.length; i++) {
                item.push(result[i].getValue({ name: 'custrecord255' }));

            for (w of item) {
            rec.selectNewLine({ 
                sublistId: 'item'      
            });

            rec.setCurrentSublistValue({  
                sublistId: 'item',
                fieldId: 'item',
                value: w,  
                forceSyncSourcing: true
            });
            };
            rec.commitLine({"sublistId": "item"});       
            };
}
else {
alert('Not Found');
}
};
    return {
    pageInit: pageInit,
    }