is there any reason why this works in 1.0: <https:...
# suitescript
s
is there any reason why this works in 1.0: https://netsuite.custhelp.com/app/answers/detail/a_id/46064/kw/newmessage/related/1 whilst
Copy code
define(['N/record','N/runtime'], function(record,runtime) {

   function beforeLoad(context) {

      var form = context.form;
      form.removeButton('newmessage'); 
      
    return true;
   }

  return {
    beforeLoad:beforeLoad
  };
});
doesn't work as 2.x? (I deployed it on the quotation record and it didn't hide as the button)
b
removeButton is an undocumented method of nlobjSubList
n
If you search "Button IDs" in help the one you're trying to remove is not on the list of buttons you can remove. @Sciuridae54696d /app/help/helpcenter.nl?fid=chapter_N3265696.html
s
so does that mean for sublist buttons we need to use 1.0?
r
proleto posted a way to hide via jquery
Copy code
const beforeLoad = (scriptContext) => {
        //create an inline html field
        var hideFld = scriptContext.form.addField({
                id:'custpage_hide_buttons',
                label:'not shown - hidden',
                type: serverWidget.FieldType.INLINEHTML
        });
        //for every button you want to hide, modify the scr += line
        var scr = "";
       // scr += 'jQuery("#print").hide();';
        scr += 'jQuery("#attach").hide();';
        //scr += 'jQuery("#addcontact").hide();';

        //push the script into the field so that it fires and does its handy work
        hideFld.defaultValue = "<script>jQuery(function($){require([], function(){" + scr + ";})})</script>"
}
🙌 1