NetSuite’s “Convert & Save” button offers a quick way to convert Leads, but this shortcut can result in skipped qualification steps and inconsistent data. Hiding this button helps companies enforce better lead management, protect data quality, and align with sales processes.
Unfortunately, this doesn’t allow you to disable it using Custom Forms or Workflows—so in this article, we’ll show you how to do it with a UserEvent script.
/**
* @NApiVersion 2.1
* @NScriptType UserEventScript
*/
define(['N/log'], function (log) {
function beforeLoad(context) {
try {
if (context.type !== context.UserEventType.CREATE &&
context.type !== context.UserEventType.EDIT &&
context.type !== context.UserEventType.VIEW) {
return;
}
var form = context.form;
var button = form.getButton({
id: 'submitconvert'
});
if (button) {
button.isHidden = true;
log.debug('Success', 'Save & Convert button hidden.');
} else {
log.debug('Info', 'Convert button not found.');
}
} catch (e) {
log.error({
title: 'Error in beforeLoad',
details: e.message
});
}
}
return {
beforeLoad: beforeLoad
};
});
Explanation:
if(context.type !== context.UserEventType.CREATE &&
context.type !== context.UserEventType.EDIT &&
context.type !== context.UserEventType.VIEW){
return;}
- Checks if the context is not Create, Edit, or View then it ends the code’s function.
var button = form.getButton({
id: 'submitconvert'
});
- Declares the Submit & Convert button.
if (button) {
button.isHidden = true;
log.debug('Success', 'Save & Convert button hidden.');
} else {
log.debug('Info', 'Convert button not found.');
}
} catch (e) {
log.error({
title: 'Error in beforeLoad',
details: e.message
});
}
}
- Hides the button then logs if it was successful. If not, it will log that the button cannot be found or the error is caught.
Results:
Before:
After:
The sample code described herein is provided on an "as is" basis, without warranty of any kind, to the fullest extent permitted by law. Oracle + NetSuite Inc. does not warrant or guarantee the individual success developers may have in implementing the sample code on their development platforms or in using their own Web server configurations.
Oracle + NetSuite Inc. does not warrant, guarantee, or make any representations regarding the use, results of use, accuracy, timeliness or completeness of any data or information relating to the sample code. Oracle + NetSuite Inc. disclaims all warranties, express or implied, and in particular, disclaims all warranties of merchantability, fitness for a particular purpose, and warranties related to the code, or any service or software related thereto.
Oracle + NetSuite Inc. shall not be liable for any direct, indirect, or consequential damages or costs of any type arising out of any action taken by you or others related to the sample code.
We’d love to hear how you integrate SuiteScripts into your NetSuite processes! Share your insights and experiences in the NetSuite Admin Corner.