I have 2 custom fields on our Purchase Order form:
custbody_po_vendor_contact (which is a list of all contacts for the selected vendor - not mandatory)
custbody_po_vendor_contact_form (this is the Contact Name that will print on the PO Form - I do not want the "company name:contact" to show on the form, just the contact name)
What I want is when the Vendor Contact (custbody_po_vendor_contact) is selected, it removes the company name from the selection and writes the contact name in the Vendor Contact [form] field (custbody_po_vendor_contact_form). Right now this field is showing on the form, but once this gets working I'd like to hide it and only reference it on the PDF layout.
Here is what I have so far (not working!):
Code:
function postSourcing(type,name)
{
if (name == 'custbody_po_vendor_contact')
{
//get the value of the Vendor Contact
var ss = nlapiGetFieldValue('custbody_po_vendor_contact');
//split the Vendor Contact up when there is a ':' (array)
var result = ss.split(":");
//write the value of the 2nd part of the array [1] into the Vendor Contact that will show on the form
nlapiSetFieldValue('custbody_po_vendor_contact_form',result[1]);
}
}
: End Code
I am getting nothing in the custbody_po_vendor_contact_form field, it just shows blank and I get no errors.
Any Ideas? Any help is greatly appreciated.
Thanks!