So have a js script in place for our salesclient order form. In it there is a onchange function that checks to see if flags are true and excutes as needed. I have added in a statement (seen below) that looks to see if the checkbox is equal to true that fields are populated however nothing happens and i get the following error message:
Script: Sales Order Client
Type: Client
Function: onFieldChange
Error: JS_EXCEPTION
TypeError The value of the property 'onFieldChange' is null or undefined, not a Function object
Here is my added code:
function onFieldChange(type, name, custbody5) {
if(type == 'item' && name == 'custcol_discount_pct') {
if(!isNaN(parseFloat(nlapiGetCurrentLineItemValue('item','custcol_non_disc_unit_rate')))) {
applyDiscount(name);
}
}
if(type == 'item' && name == 'rate') {
var rate = parseFloat(nlapiGetCurrentLineItemValue('item','rate'));
if(!isNaN(rate)) {
if(isNaN(parseFloat(nlapiGetCurrentLineItemValue('item','custcol_non_disc_unit_rate')))) {
nlapiSetCurrentLineItemValue('item','custcol_non_disc_unit_rate',rate,false,true);
setDollarPriceSB(name);
}
applyDiscount(name);
}
}
if(type == 'item' && name == 'quantity') {
if(!isNaN(parseFloat(nlapiGetCurrentLineItemValue('item','custcol_non_disc_unit_rate')))) {
applyDiscount(name);
}
}
if(custbody5 == 'T') {
nlapiSetFieldValue('fob','Destination');
nlapiSetFieldValue('custbody_fulfillment_comment','FOB Destination'); // SR #00,000
alert('FYI: FOB set to Destination.');
}
else if(custbody5 == 'F'{
nlapiSetFieldValue('fob',"");
nlapiSetFieldValue('custbody_fulfillment_comment',"");
}
if(name == 'custbody_shipto_enduser') {
if(nlapiGetFieldValue('custbody_shipto_enduser') == 'T') {
setShipAddressToEndUserAddress();
}
}
}
Can anyone help me figure out where the problem lies.
Thanks :):)