Discussions
Join us for complimentary one-day events around the world and step into a future fueled by AI and limitless potential. Explore new breakthroughs, sharpen your skills, and connect with experts who are shaping what’s next. Experience bold keynotes, interactive learning, and connections that span the global NetSuite community. Discover what's next at SuiteConnect Tour 2026.
Simple script issue Submit NOT working
I am trying to create an inventory item in suitescript but I keep getting the following error Invalid reference key [null].
This code is called on an aftersubmit basis on a Custom record:
function setItem()
{
title = "test inventory item";
newRecord = nlapiCreateRecord('inventoryitem');
id = newRecord.getId();
newRecord.setFieldValue('itemid',"test inventory item");
type = newRecord.getRecordType();
newRecord.setFieldValue('cogsaccount',122);
newRecord.setFieldValue('assetaccount',121);
newRecord.setFieldValue('department',"Glasgow Opportunities");
newRecord.setFieldValue('class',"O.D.C : Training : Bespoke Training (Large Project");
newRecord.setFieldValue('purchasetaxcode',"Go:GO-na");
newRecord.setFieldValue('salestaxcode',"Go:GO-S");
debugTxt = "newRecord is "+newRecord+id+type;
nlapiLogExecution('DEBUG','<Before Load Script>',debugTxt);