Discussions
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);