The CreatorCon Call for Content is officially open! Get started here.

Pop up with yes/no action

Sam Ogden
Tera Guru

Hi,

On our catalog tasks there is a 'close task' UI Action.   When this is selected we require that a popup box appears with the message:

'Are you sure you want to complete this task?'

with a yes/no option.

If yes selected the UI action continues to run.

If no UI Action does not run and returns you to the task.

I believe that the script in the 'close task' UI action can be modified to achieve this, I'm just not sure on what script I need to use?

Any help is greatly appreciated.

1 ACCEPTED SOLUTION

I can see you have an additional braces at the end of the code '}' (line 17). Can you move it above the if condition which will correctly close the function closeTask().



Thanks


Please Hit like, Helpful or Correct depending on the impact of the response


View solution in original post

12 REPLIES 12

Alikutty A
Tera Sage

Hi Sam,



You can add this code in your UI Action, The UI action should have code that runs on client side.



var check = confirm("'Are you sure you want to complete this task?");


if(check){


  alert("I confirm");   // Execute your client code here


}



Thanks


Please Hit like, Helpful or Correct depending on the impact of the response


Hi Alikutty,



Just tried this, but the existing code for the UI action starts with a function.   If I add your above code before this I am getting a warning on the function line:



find_real_file.png


Can you remove the code in line 4 ? function closeTask(). The function does not exist in UI Action and you are already setting the state value to 3 and closing it.



Please try and let me know



Thanks


Please Hit like, Helpful or Correct depending on the impact of the response


Also I think you have duplicated the code to close task by including server side logic. I believe this code is enough for task closure.



var check = confirm("'Are you sure you want to complete this task?");


if(check){


  alert("I confirm");   // Execute your client code here


  g_form.setValue('state', 3);


  gsftSubmit(null, g_form.getFormElement(), 'close_sc_task');


}



Note: code may have typos