Hello,
I spoke with Netsuite support about setting a default value for the "department" field on a custom form. They advised that I could run the following script as a User Event Script.
I don't know how to script or set this up.
Outcome:
Set department on a sales order to a default value: department field = icandy Creative
Code Provided by Support:
*** START CODE ***
var customForm = nlapiGetFieldValue('customform');
if(customForm == 100) // You may simply replace '100' with the internal ID of your custom form.
{
....place your code here....
}
*** END CODE ***
My Code:
// *** START CODE ***
var customForm = nlapiGetFieldValue('customform');
if(customForm == 117) // You may simply replace '100' with the internal ID of your custom form.
{
nlapiSetFieldValue('department', icandy Creative);
}
// *** END CODE ***
I have edited the custom form and uploaded the .js file to my account.
Custom Form ID: 117
Custom Code
Script File: Set_department.js
Page Init Function: edit
Error Message:
An unexpected error occured in a script running on this page.
Edit(pageInit)
customform
JS_EXCEPTION
ReferenceError edit is not defined
Any help will be apprciated.
Once this is working, I then what to make the depertment field "inline" so the user can't change the value. Will this script still work on load and set the value, even though the user can't change it?
Regards
Warwick