Using this Methode we can restrict the badges to show only for the selected employes. using the NetSuite customization
var allowedEmails = [
"kim@smeincusa.com",
"pam@smeincusa.com",
"diego@smeincusa.com",
"grabthemail@gmail.com",
"dmitry.k@itdelight.com"
];
var currentUser = runtime.getCurrentUser();
var currentUserEmail = currentUser.email;
log.debug('currentUserEmail ',currentUserEmail);
// Check if the current user's email is in the allowedEmails array
if (allowedEmails.indexOf(currentUserEmail) !== -1) {
// If user is allowed, create an inline html field to hide the button
var hideFld = scriptContext.form.addField({
id: 'custpage_hide_buttons',
label: 'not shown - hidden',
type: serverWidget.FieldType.INLINEHTML
});
log.debug('hideFld ',hideFld);
// Hide the button using jQuery
var scr = 'jQuery("#custom714lnk").show();';
// Push the script into the field so that it fires and does its handy work
hideFld.defaultValue = "<script>jQuery(function($){require([], function(){" + scr + ";})})</script>";
}