So we have a script running on our opportunity form... It populates some custom fields based on the value of the class field... Anyway, we are getting (occasionally) a popup error stating "JS_EXECPTION TypeError object expected"...
It's a fieldchanged client script funciton, and begins with the following (below). My question is:
The function states "(type,fieldname)"... The first if statement uses the fieldname, but not a type, whereas in other scripts we might have:
if(type=='item' && fldname=="blah")
Now the class field is a header field, so what is the sublist type for header/body/mainline whatever you want to call them fields?
I tried if(type=='body' && fldname=='class), but that did nto seem to work...
Any help is apprecaited,
Matt S
function setfields(type,fldname)
{
if (fldname == 'class')
{
var class=nlapiGetFieldValue('class');
//SET PRODUCT LINE
if (class==1 || class==15 || class==7 || class==8) //class IS CR
nlapiSetFieldValue('custbody_productline', 2, false);
if (class==10 || class==11 || class==12) //class IS EV
nlapiSetFieldValue('custbody_productline', 1, false);
if (class==9) //class IS Peep SSA
nlapiSetFieldValue('custbody_productline', 3, false);
//SET TYPE OF BUSINESS
if (class==1 || class==10 || class==8) //NEW business
nlapiSetFieldValue('custbody_typeofbusiness', 1, false);
if (class==15 || class==7 || class==12 || class==9 || class==11) //Renewal business
nlapiSetFieldValue('custbody_typeofbusiness', 2, false);
//SET CUSTOMER STATUS
if (class==1 || class==10) //New Customer
nlapiSetFieldValue('custbody_customerstatus', 1, false);
if (class==15 || class==7 || class==8 || class==12 || class==11 || class==9) //Ext Customer
nlapiSetFieldValue('custbody_customerstatus', 2, false);
} //end if field is class
return true;
};