2

I am adding a button by workflow. Later I want to hide that button, using a server script. In order to do that, I need the button's internal ID, how to get the internal id of a button in netsuite?

Ajith V
  • 53
  • 5
  • Is there a reason you need to hide the button with a script? If you are already using a workflow to add a button, why not use a workflow to hide the button too? There is an "Action" called 'Remove button', where you can apply an appropriate condition. – Arif WB Dec 23 '21 at 21:07
  • Well I just want to hide the button, I can't remove the button because I want it for transition of stage. And I want to hide it, because we don't get click event for workflow buttons. I have added another button, using Dom and I get a click event for it. After executing click event, I will mimic the clicking of workflow button and make the transition of stage. – Ajith V Dec 25 '21 at 04:00

2 Answers2

0

In my case created a form with text field to store a value and hiding the field. This may help

var form = serverWidget.createForm({
                title: 'Simple Form'
            });
            var field = form.addField({
                id: 'custpage_file',
                type: 'file',
                label: 'Upload CSV'
            });
            form.addSubmitButton({
                label: 'Submit'
            });
           var textfield=form.addField({
                 id : 'custpage_vendor_id',
                 type : 'text',
                 label : 'Text',
                 value :'Text'
                 });
          textfield.defaultValue = 123;
          textfield.updateDisplayType({
                    displayType : serverWidget.FieldDisplayType.HIDDEN
                  });
          context.response.writePage(form);
0

If you want to find the ID, you can simply right click on the button and click on Inspect (Microsoft Edge or Chrome).

In the dialog box opened, you can check for the field id and you will get the ID of the button.

Something like -

enter image description here

Give this a try. Let me know.

Sayeesh
  • 208
  • 1
  • 3
  • 13
  • This is DOM. Button's ID in DOM is different from the button's ID that we use in SuiteScript. – Ajith V Feb 09 '22 at 07:53
  • @AjithV You can use JQuery within your suitescript code to get rid of the button. Will EDIT my answer later today. – Sayeesh Feb 10 '22 at 03:53
  • Ya, that's how i have implemented it now. But DOM may vary with each netsuite update and so I am searching for an Netsuite API solution. – Ajith V Feb 11 '22 at 04:15