what type of Suite Script should I use to make a c...
# ask-stanley-ai
i
what type of Suite Script should I use to make a confirmation modal when deleting a record.
c
AI generated answer (using internal Slack threads):
To create a confirmation modal when deleting a record, you can use a Client Script in SuiteScript. Specifically, you can use the
N/ui/dialog
module to create a confirmation dialog box. However, please note that SuiteScript does not offer a way to delete script records directly. Here is a sample code snippet that shows how to create a confirmation dialog box:
Copy code
javascript
/**
 * @NApiVersion 2.x
 * @NScriptType ClientScript
 */
define(['N/ui/dialog'], function(dialog) {
    function confirmDeletion() {
        var options = {
            title: "Confirm Deletion",
            message: "Are you sure you want to delete this record?"
        };
        dialog.confirm(options).then(function(result) {
            if(result) {
                // Code to delete the record
            }
        }).catch(function(reason) {
            console.log("User cancelled deletion");
        });
    }
    return {
        saveRecord: confirmDeletion
    };
});
In this code, the
confirmDeletion
function is called when the user attempts to save the record. The function creates a confirmation dialog box with the title "Confirm Deletion" and the message "Are you sure you want to delete this record?". If the user confirms the deletion, the code to delete the record is executed. If the user cancels the deletion, a message is logged to the console. ****** 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.816784263
Slack thread 2: here (available only if the original thread was posted in the last 90 days)
Similarity score: 0.815504313
Slack thread 3: here (available only if the original thread was posted in the last 90 days)
Similarity score: 0.814176321
Please provide your feedback on this answer.