Join the #BuildWithBuildAgent Challenge! Get recognized, earn exclusive swag, and inspire the ServiceNow Community with what you can build using Build Agent.  Join the Challenge.

UI action confirmation is not working properly

JJG
Kilo Guru

Hello,

I have a UI action button and when it is clicked it asks the user for confirmation about closing a record (see pics below).

For some reason when I click 'Ok' on the confirmation, nothing happens. Is my code off? 

find_real_file.png

find_real_file.png

1 ACCEPTED SOLUTION

I modified the code slightly and this worked:

function closeRecord() {
var answer = confirm("Are you sure you want to close this candidate record?");
if (answer == true) {
gsftSubmit(null, g_form.getFormElement(), "ACTION_NAME");
}
if (answer == false) {
return false;
}

}

if (typeof window == 'undefined') {
UpdateStatus();
}

function UpdateStatus() {
current.status = "closed_no_interest";
current.update();
action.setRedirectURL(current);

}

View solution in original post

7 REPLIES 7

 

 Try the same thing on the incident table.

I modified the code slightly and this worked:

function closeRecord() {
var answer = confirm("Are you sure you want to close this candidate record?");
if (answer == true) {
gsftSubmit(null, g_form.getFormElement(), "ACTION_NAME");
}
if (answer == false) {
return false;
}

}

if (typeof window == 'undefined') {
UpdateStatus();
}

function UpdateStatus() {
current.status = "closed_no_interest";
current.update();
action.setRedirectURL(current);

}

in the onClick i have a semicolon after closeRecord();