How to hide the new button next to a custom field
# ask-stanley-ai
h
How to hide the new button next to a custom field
c
AI generated answer (using internal Slack threads):
To hide the 'New' button next to a custom field in NetSuite, you can use a ClientScript with an Inline HTML field. Here's a step-by-step guide: 1. Create a ClientScript file in SuiteScript 2.0. Here's a sample code snippet:
Copy code
javascript
/**
 * @NApiVersion 2.x
 * @NScriptType ClientScript
 */
define(['N/search'], function(search) {
    return {
        pageInit: function(context) {

            //create an inline html field
            var hideFld = context.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("#newrecrecmachcustrecord_volumesubprojectparent").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>"
        }
    }
});
2. In the script, you're creating an Inline HTML field (
custpage_hide_buttons
) that is hidden (
label:'not shown - hidden'
). 3. You then define a script (
scr
) that uses jQuery to hide the 'New' button. Replace
#newrecrecmachcustrecord_volumesubprojectparent
with the ID of your 'New' button. 4. Finally, you set the
defaultValue
of the Inline HTML field to the script. This will execute the script when the page loads, hiding the 'New' button. Remember to deploy the script to the appropriate record type. ****** Disclaimer: This response was generated by an artificial intelligence assistant based on previous conversations from multiple Slack channels, and may contain inaccuracies or mistakes. ******
Slack thread 1: here (available only if the original thread was posted in the last 90 days)
Similarity score: 0.82312429
Slack thread 2: here (available only if the original thread was posted in the last 90 days)
Similarity score: 0.818578
Slack thread 3: here (available only if the original thread was posted in the last 90 days)
Similarity score: 0.806952417
Please provide your feedback on this answer.