Netsuite - Add Button to Custom Record

1.5k views Asked by At

I am trying to add a button to a record in netsuite. This is a "Testing" record. When a user presses the button, I want a new testing record to be created that will be a child of the existing record.

In my User Event script, I have added the following code to my beforeLoad function

form.addButton({
    id           : 'custpage_add_retest_btn', 
    label        : 'Add Re-Test', 
    clientScriptFileId : 1245,
    functionName : 'createReTestRecord'
    });

The button shows up on the record, but when I press it, it says that createReTestRecord does not exist. In my client side script, I have a function

function createReTestRecord() {
    alert("Hi! from New Test Button!");
}

Can anyone tell me what is wrong?

1

There are 1 answers

0
user3075978 On BEST ANSWER

The addButton does not have a property called clientScriptFileId. You need to use the clientScriptModulePath to attach client script to the form.

It should look like this:

form.clientScriptModulePath = './YOUR_SCRIPT_FILE';

form.addButton({
    id           : 'custpage_add_retest_btn', 
    label        : 'Add Re-Test', 
    functionName : 'createReTestRecord'
});