I have a user event script that is modifying a form upon load. I also have a client script(field change) that is attached to that form. Basically I have it to where when the user selects a vendor in the vendor field the script builds the sublist based on that criteria. Everything works, except I have a field called custpage_item_item that is a select field linked to the inventory item. I have done this many times but for some reason when I build the sublist I can't set the item in that field. It gives me "reference error selectmap is not defined".
list.addField('custpage_item_item', 'select', 'Item','item'); that is the field I am creating on the user event before load script.
In the client script I have a function that builds the sublist. I have 20 or so fields and all are working except the item field. If I change the field type to text it works. I have tested to make sure I am getting values. I am pulling the internal ID of the item (which I have done perfectly fine in other scripts).
nlapiSelectNewLineItem('custpage_sublist_items');
nlapiSetCurrentLineItemValue('custpage_sublist_ite ms','custpage_item_item', itemId, false,true);
nlapiCommitLineItem('custpage_sublist_items');
I am at a loss as to the problem. The error does not make sense to me. The select field is defined. I can add items to the sublist manually just fine from the form.