how to populate Yes or No alert?

Rithvik2
Tera Contributor

I had a select box with options as yes or no or none[none is not a default one...its also a option]options..

when the user selected as "yes" then we need an alert popup with "Would you like to continue?" or "Not" options

If user selected No then we need to change the select box option to None else selected option i.e., Yes will be as it is..there will be no change

 

1 ACCEPTED SOLUTION

Ankur Bawiskar
Tera Patron
Tera Patron

Hi,

You can have onChange Client Script on that Select box variable

But you cannot have custom text on the confirm box. It would be OK and CANCEL

function onChange(control, oldValue, newValue, isLoading) {
    if (isLoading || newValue == '') {
        return;
    }

// use valid choice value here
if(newValue == 'yes'){

if(!confirm('Would you like to continue?')){
// user clicked on CANCEL
g_form.clearValue('variableName'); // give your variable name here
}

}

}

Regards
Ankur

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader

View solution in original post

8 REPLIES 8

Hi @Ankur Bawiskar 

 

If I have multiple Yes or no variables. on the selection of yes for the two questions. I want to show an alert. how to achieve that?

Hi Sai,

onchange client script

Regards
Ankur

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader

Hi Ankur,

can you please share a Snippet? 

 

Thanks

Hi Sai,

you will require multiple onchange client script on each variable

Regards
Ankur

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader