- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-28-2017 07:30 AM
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.
Solved! Go to Solution.
- Labels:
-
User Interface (UI)
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-28-2017 08:46 AM
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
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-28-2017 08:23 AM
Tried with this code and got the same outcome as mentioned in my other reply.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-28-2017 08:18 AM
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
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-28-2017 08:39 AM
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?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-28-2017 08:46 AM
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
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-28-2017 08:51 AM
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();
}
}
Thanks
Please Hit like, Helpful or Correct depending on the impact of the response