Discussions
Stay up-to-date with the latest news from NetSuite. You’ll be in the know about how to connect with peers and take your business to new heights at our virtual, in-person, on demand events, and much more.
Now is the time to ask your NetSuite-savvy friends and colleagues to join the NetSuite Support Community! Refer now! Click here to watch and learn more!
Scheduled script fails to load Item Record ..
Hi,
I have a Scheduled script that updates certain fields of the Item Record.The script has a search function which search for items.
var searchResultArr = nlapiSearchRecord('item', null, filtersArr, cols);
It succeeds in searching the items..but the script fails when it reaches the line
record = nlapiLoadRecord('item', itemIntId);
Any ideas??
//for (var i = 0; searchResultArr != null && i < searchResultArr.length ; i++) for (var i = 0; i < 1 ; i++) { itemRecord = searchResultArr[i]; manuText = itemRecord.getValue('custitem_manufacturer_text'); deptText = itemRecord.getValue('custitem_system_text'); categoryText = itemRecord.getValue('custitem_category_text'); itemName = itemRecord.getValue('name'); itemIntId = itemRecord.getValue('internalid'); nlapiSendEmail(-5, '43486', 'Infra :Item before update ',emailMsg, null, null, null); //load the record record = nlapiLoadRecord('item', itemIntId); //set the Department,DNet Manufacturer & DNet Category fields record.setFieldValue('custitem_manufacturer', manuText); record.setFieldValue('department', deptText); record.setFieldValue('custitem_category', categoryText); nlapiSubmitRecord(record, false); record = null; emailMsg = emailMsg + "n" +i +":"+ itemName ; } 0