Hello !! Do you know how to attach the ‘Delete’ bu...
# suitescript
w
Hello !! Do you know how to attach the ‘Delete’ button functions (that is to say delete the current record and record the comment of the deleted transaction into the transaction numbering audit log search) into a custom button of a custom record?
b
the suitescript method is to reimplement the delete button using nlapiDeleteRecord
the javascript method is to get the delete button using something like document.getElementById and then virtually click it using .click()
im not sure if you can do the delete reason for custom records
w
Thank you ! and for Suitescript, do you know how to input the function input a button (when the button is clicked, the record is deleted)
script parameter is the onClick
w
Thank you !!! Much appreciated
b
most sane approach is to attach a client script to the form using https://system.na0.netsuite.com/app/help/helpcenter.nl?fid=section_N3144618.html#bridgehead_N3153135 so that you can have a function that your button calls
w
👍
This is what I built based on SS 2.0, I believe the issue came from the variable custonRecord following the deleteRecord function. Do you have any ideas of the issue(s)? Right now I click on the button nothing happens
b
Ss2 code looks ok, minus no delete reason
What does the user event beforeLoad look like
w
I replaced PageInit by BeforeLoad but a message says that beforeLoad is not defined…
b
You would add the button either in a user event before load script
Or you can use the form record's button
w
Like this? I changed the script type and the PageInit for beforeLoad
b
BeforeLoad is a user event entry point
Dont use it outside a user event script
How are you adding your button
w
I createad a custom button when importing my script deployment
Where should I set the beforeLoad in my script?