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

HarshTimes
Tera Guru

//You have set this ui action to run as a client side. Current object will not work in the function. There will be two part for this UI action. One client side and another serve side.
//When you will click on the ui aciton it will execute the function and then the other part of this Ui action See the code below.

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); // add action name to your ui aciton and put here.

}// close function


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

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

//Update and reload the record
action.setRedirectURL(current);
current.update();

}

It does not seem to be working, the form status does not update and it does not stay on the same record when it reloads, am I missing something?

find_real_file.png

I tried this on my incident table and it does work. (i changed the state value)

is the value of status the text value you entered? (and not an integer)

is the field name status? no prefix?

 

Yes, the field name is "status" and the value is closed_no_interest (see pics below)

find_real_file.png

find_real_file.png

 

When I click 'Ok", I am redirected to the pic below, and the status is the same

 

find_real_file.png