Hello !! By any chance, do you have an idea of how...
# suitescript
w
Hello !! By any chance, do you have an idea of how to create a delete function (like the Delete button provided by NS) to be added to a custom button. I tried to build one based on NS documentation but it doesn't work (I just started learning Suitescript btw)
m
Are you sure you can’t just edit the form and enable the “delete” action before you attempt to do this with SuiteScripts? Most record types support that.
d
for type property provide value in string
example : type: "customrecord100"
m
Oh, then you can’t use the record.Type enum to set that. Do it more like this:
w
Actually I have created a custom record to save transactions and attach files to it before deleting, that is why I wanted to add a 'delete' button in it. I will try your solution, thanks folks !!
This message error pops up whereas I have put 1 function in my script, do you have an idea of the origin of the error?
n
@William Lim what kind of script is it? UE? You need somewhere for the script to start. Not sure what kind of script you're running but here's documentation on it for UE scripts: app.netsuite.com/app/help/helpcenter.nl?fid=section_4490073437.html
w
It is a ClientScript type, also I can't log in to your link, what should I write on the help center search bar ?
n
@William Lim just paste it after the .com/, here's one for Client scripts: https://your-customer-id.app.netsuite.com/app/help/helpcenter.nl?fid=section_4410597671.html Just change the "your-customer-id" to your customer ID, or search for "pageInit" in the help. Basically you need to have an entry point to your script. If you want to, you can also do a custom entry point, would look somewhat like this at the bottom of your client script:
Copy code
return {
    pageInit: pageInit,
    myFunction: myFunction
};
Just an example though.
w
Thank you very much, I appreciate ! I'll try it
👍 1
m
@William Lim to address your actual issue of wanting to delete files before the record is deleted - instead of replacing the delete functionality you should be able to create a user event script that runs on delete
👍 1
w
Hi, so I can 'call' the delete function through an user event script? I don't clearly understand
m
You wouldn't call the delete function. You would allow the user to delete the record via the native functionality and then handle the event in your user event script to delete dependent records first
w
Ok, I will try to find out on how to do it, thanks a lot! Btw if you have any websites regarding NetSuite tutorial for beginners I would be more than interested!