<?xml version="1.0" encoding="utf-8"?>
<rss xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title>Answers to: How to reset a task back to state SUSPENDED cancelled by the user</title><link>https://answers.axonivy.com/questions/649/how-to-reset-a-task-back-to-state-suspended-cancelled-by-the-user</link><description>&lt;p&gt;(This question belongs to ivy 5.x)&lt;/p&gt;
&lt;p&gt;If a user opens a task (which presents a user dialog to him) and then, a little later he cancels the task (exits from user dialog), xpert.ivy finishes this task and set it's state to DONE. In such a case (after cancelling), the Task should go back to the state SUSPENDED it had before the user started it.&lt;/p&gt;
&lt;p&gt;I don't want to delete this task and recreate it, so I tried to reset the task by calling the method ivy.task.reset() in a script element after closing the user dialog, but ivy returns the following error message:&lt;/p&gt;
&lt;p&gt;"Session 1 (xyz) is not allowed to call method public void ch.ivyteam.ivy.workflow.internal.Task.reset().
The session does not fulfill the permission rule SESSION OWNS TaskReset PERMISSION OR OWNS TaskReset@SYSTEM PERMISSION"&lt;/p&gt;
&lt;p&gt;It's no problem to set this rights by the Administration Console, but it's not useful to set this right to all users created in ivy.
Is there a way to set the appropriate permission within an ivy script element or is there another doing to reset a task?&lt;/p&gt;
&lt;p&gt;Thanks&lt;/p&gt;</description><atom:link href="https://answers.axonivy.com/questions/649/how-to-reset-a-task-back-to-state-suspended-cancelled-by-the-user" rel="self"></atom:link><language>en</language><lastBuildDate>Mon, 04 Aug 2014 16:12:48 -0400</lastBuildDate><item><title>Answer by Christian Strebel</title><link>https://answers.axonivy.com/questions/649/how-to-reset-a-task-back-to-state-suspended-cancelled-by-the-user/892</link><description>&lt;p&gt;See answer of question &lt;a href="http://answers.xpertivy.ch/questions/744/"&gt;How can I disable Xpert.ivy security/permission checks&lt;/a&gt;. It explains how you can disable permission checking on designer and server with an small java helper class.
As already mentioned it is possible per API to grant/deny permissions of a role or user (Also this API is used by the Administration UI, which is an Ivy Project). See answer of question &lt;a href="http://answers.xpertivy.ch/questions/654/"&gt;How to grant permssions to a user or role in Designer&lt;/a&gt;.&lt;/p&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Christian Strebel</dc:creator><pubDate>Mon, 04 Aug 2014 16:12:48 -0400</pubDate><guid>https://answers.axonivy.com/questions/649/how-to-reset-a-task-back-to-state-suspended-cancelled-by-the-user/892</guid></item><item><title>Answer by roland</title><link>https://answers.axonivy.com/questions/649/how-to-reset-a-task-back-to-state-suspended-cancelled-by-the-user/889</link><description>&lt;p&gt;Hi Stefan,&lt;/p&gt;
&lt;p&gt;are you using JSF Dialog?
In my RIA Dialog i created an Event Task reset which is call when then Window is unloaded. 
It is just one Skript step needed.
if (!in.propperClosed)
{
    ivy.task.reset();
}&lt;/p&gt;
&lt;p&gt;If you use JSF Dialogs there is a little bit more to do.&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;you need a callable process wich will do the Task reset and has the taskID as Input parameter. You could use the CancelTask form HTMLWFUI as example&lt;/li&gt;
&lt;li&gt;you Need a Button in jsf which calls this process
 i did the following:&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;create an attribut URL which is filled with the correct URL of the callable process by dialog start event.&lt;/p&gt;
&lt;p&gt;JavaScript which calls URL &lt;/p&gt;
&lt;p&gt;function cancel(url) 
 {
  document.location=url;
 }&lt;/p&gt;
&lt;p&gt;a command Button which call the script&lt;/p&gt;
&lt;p&gt;p:commandButton onclick="cancel(#{data.url})"&lt;/p&gt;
&lt;p&gt;I never had problems with the rights in designer, only on Server, there you Need the rights.&lt;/p&gt;
&lt;p&gt;hope this helps
Roland&lt;/p&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">roland</dc:creator><pubDate>Sun, 03 Aug 2014 13:16:33 -0400</pubDate><guid>https://answers.axonivy.com/questions/649/how-to-reset-a-task-back-to-state-suspended-cancelled-by-the-user/889</guid></item><item><title>Answer by Reto Weiss</title><link>https://answers.axonivy.com/questions/649/how-to-reset-a-task-back-to-state-suspended-cancelled-by-the-user/656</link><description>&lt;p&gt;See question &lt;a href="http://answers.xpertivy.ch/questions/654"&gt;654&lt;/a&gt; to see how to assign (grant) permissions in the Designer.&lt;/p&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Reto Weiss</dc:creator><pubDate>Fri, 25 Apr 2014 08:51:56 -0400</pubDate><guid>https://answers.axonivy.com/questions/649/how-to-reset-a-task-back-to-state-suspended-cancelled-by-the-user/656</guid></item><item><title>Answer by Stefan Kressig</title><link>https://answers.axonivy.com/questions/649/how-to-reset-a-task-back-to-state-suspended-cancelled-by-the-user/653</link><description>&lt;p&gt;Hi Reto,
Thanks a lot for your quick response, but I think that I expressed the problem not clearly: The Task should be resetted before it's going to state DONE, not after it reaches this state.&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;I take a task (SUSPENDED) which is assigned to me or a to group I belong to&lt;/li&gt;
&lt;li&gt;user dialog is opening (the Task is now in state RESUMED), dialog offers two ways: Cancel and OK&lt;/li&gt;
&lt;li&gt;I choose cancel, exits the User Dialog, the process is going the "cancel" path&lt;/li&gt;
&lt;li&gt;the process is going through an Ivy Script Element on which the Task should be resetted (set back to SUSPENDED) by statement ivy.task.reset() 
(=&amp;gt; Permission Error occurs)&lt;/li&gt;
&lt;li&gt;The process reaches the Endpoint (on which the Task becomes the DONE State (which is O.K. when I click OK in the User Dialog)&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;But you're right: I'll try to create a group with appropriate rights for Task Handling and assign all users to this group. This could work.&lt;/p&gt;
&lt;p&gt;One more question: How can I assign this right/permission within the Designer?&lt;/p&gt;
&lt;p&gt;Thanks a lot and regards,
Stefan&lt;/p&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Stefan Kressig</dc:creator><pubDate>Thu, 24 Apr 2014 20:15:51 -0400</pubDate><guid>https://answers.axonivy.com/questions/649/how-to-reset-a-task-back-to-state-suspended-cancelled-by-the-user/653</guid></item><item><title>Answer by Reto Weiss</title><link>https://answers.axonivy.com/questions/649/how-to-reset-a-task-back-to-state-suspended-cancelled-by-the-user/652</link><description>&lt;ol&gt;
&lt;li&gt;At the moment a task in state DONE cannot be reset in Xpert.ivy. Calling the reset method on the task will throw an IllegalStateException. &lt;/li&gt;
&lt;li&gt;Permissions can also be set to Roles. So you can set the TaskReset Permission to a Role which is owned by users that are allowed to reset tasks.&lt;/li&gt;
&lt;li&gt;You can turn off the Xpert.ivy security in Java before calling the method. For more details see question &lt;a href="http://answers.xpertivy.ch/questions/227"&gt;227&lt;/a&gt;.&lt;/li&gt;
&lt;/ol&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Reto Weiss</dc:creator><pubDate>Thu, 24 Apr 2014 11:41:40 -0400</pubDate><guid>https://answers.axonivy.com/questions/649/how-to-reset-a-task-back-to-state-suspended-cancelled-by-the-user/652</guid></item></channel></rss>