Find your people. Pick a challenge. Ship something real. The CreatorCon Hackathon is coming to the Community Pavilion for one epic night. Every skill level, every role welcome. Join us on May 5th and learn more here.

cancel button on change task

harry24
Tera Contributor

Hello 

I want to create cancel button on change task which will cancel the change task .

It should make worknote field mandatory and add pop up whenever user tries to cancel the change task 

6 REPLIES 6

Nisha15
Mega Sage

Hi @harry24 
create a client callable ui action
onclick call the function name:openConfirmationDialog()
use the below code:

function openConfirmationDialog() {
    var gm = new GlideModal("glide_confirm_standard", true, 600);
    gm.setTitle("Test title");
    gm.setPreference("title", "Test body text");
    gm.setPreference("warning", "false");
    gm.setPreference("onPromptComplete", function() {
        g_form.setMandatory('work_notes', true);
    });
    gm.setPreference("onPromptCancel", function() {
        alert("You clicked on 'Cancel'");
    });
    gm.render();
}

Dr Atul G- LNG
Tera Patron

Hi @harry24 

 

Why you need a button, we have OOTB cancel value in state and use that to do your work. 

 

AGLearnNGrow_0-1714390963042.png

 

*************************************************************************************************************
Regards
Dr. Atul G. - Learn N Grow Together
ServiceNow Techno - Functional Trainer
LinkedIn: https://www.linkedin.com/in/dratulgrover
YouTube: https://www.youtube.com/@LearnNGrowTogetherwithAtulG
Topmate: https://topmate.io/dratulgrover [ Connect for 1-1 Session]

****************************************************************************************************************