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

Tried with this code and got the same outcome as mentioned in my other reply.


Cheers for the above.



It has not worked.   When I went to try this as soon as I clicked on a task the popup displayed before I had clicked on the 'close task' UI button.   on the form there are 2 UI Actions.   The one in the banner (first screenshot) has now stopped doing anything.   The one lower down the form (second screenshot) now fires the popup box as expected.   If click ok a second popup box displays saying "I confirm' it is then taking me to a new task record and the popup displays again.   I have reverted the code back to how it was and provided screenshots of the code


find_real_file.png


find_real_file.png


find_real_file.png


find_real_file.png


find_real_file.png


Hi Alikutty,



I've amended the code to the below.   This is now displaying the popup message as I am expecting when using either of the UI action buttons.   I can briefly see it changes the state to Closed Complete before the window goes to reload, but If I then go back to that task it is showing as open still, any suggestions?



find_real_file.png


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


If the above code din't work, you can use this code. I have tested it on my developer instance and it was working. You should replace the code in all the 3 UI Actions for close task.



function closeTask(){


  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);


  g_form.save();


  }


}



find_real_file.png



Thanks


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