How to add Alert message to a OOB Document pdf task Widget without cloning the widget?

SonaK
Tera Contributor

Hi. I need to add a confirmation message on click of the submit button on a PDF document to-do task (which is configured through Widget). How can I achieve it using client scripts without touching the widget? Please advise. Thanks!

2 REPLIES 2

Dnyaneshwaree
Mega Sage

Hello @SonaK ,

Create onsubmit client script and refer below logic or create BR and use same logic by removing return values:

(function executeRule(current, previous /*null when async*/) {
    // Your condition to check before showing confirmation
    if (current.some_field == 'some_value') {
        // Show a confirmation message
        if (!confirm('Are you sure you want to submit this task?')) {
            // If the user clicks "Cancel", prevent form submission
            return false;
        }
    }
    return true;
})(current, previous);

 

Please accept my solution if it works for you and thumps up to mark it as helpful.
Thank you!!

Dnyaneshwaree Satpute
Tera Guru

Hi @Dnyaneshwaree Thanks for your response! I already tried with an onSubmit script applied on the doc task table. But the problem is the submission of the task is embedded in a widget that the client script doesn't kick off on submission. Not if there is another table or way that I can have my client script on so that it can kick off when it is submitted through the widget.