roll back a case to previous step

ProcessMaker code contributions

Moderator: amosbatto

User avatar
ashkufaraz
Posts: 163
Joined: Mon Sep 22, 2014 9:36 am
Country: Iran
Location: Iran,Yazd
Contact:

roll back a case to previous step

Unread postby ashkufaraz » Mon Sep 22, 2014 9:54 am


in process maker I assign some tasks usedStart Custom ``Task action to some users,

I want to know that is there any way to roll back to previous tasks in such a workflow,

for example if one of users (user1) reject task by mistake and workflow create another task

for next user (user2), is it possible to roll back workflow to previous step and assign task

to user1 again?

I'll be appreciated if anyone could help me.
رمضان کریم است
[email protected]

User avatar
liliana
Posts: 2420
Joined: Wed Jun 01, 2011 11:24 am

Re: roll back a case to previous step

Unread postby liliana » Mon Sep 22, 2014 11:19 am

Hi,

To go back in your process you can use the Selection Routing Rule, depending on a condition your case will go back to the task you have to define.

To derive your case to the same user you can use the attached example.

Regards,
Attachments
LoopbackExample.pm
(13.62 KiB) Downloaded 57 times
Liliana Iriarte
Technical Writer

User avatar
ashkufaraz
Posts: 163
Joined: Mon Sep 22, 2014 9:36 am
Country: Iran
Location: Iran,Yazd
Contact:

Re: roll back a case to previous step

Unread postby ashkufaraz » Tue Sep 23, 2014 12:35 am

hi,
thanks for replay.
if one of users (user1) reject task by mistake and workflow create another task
for next user (user2) then in these circumstances,what to do?
---------------------------------------------------------------------
in the big system with diffrent process and sub process.
we have add new evalution for any task?
---------------------------------------------------------------------
or
in the municipal systems
Mayor wants to change workflow and roll back a specific task to custom task
رمضان کریم است
[email protected]

User avatar
ashkufaraz
Posts: 163
Joined: Mon Sep 22, 2014 9:36 am
Country: Iran
Location: Iran,Yazd
Contact:

Re: roll back a case to previous step

Unread postby ashkufaraz » Wed Sep 24, 2014 1:20 am

db=workflow
by change app_delegate and app_cache_view and app_thread i could create new refrence between task of one process
رمضان کریم است
[email protected]

User avatar
ashkufaraz
Posts: 163
Joined: Mon Sep 22, 2014 9:36 am
Country: Iran
Location: Iran,Yazd
Contact:

Re: roll back a case to previous step

Unread postby ashkufaraz » Mon Apr 06, 2015 1:58 am

should delete record from end list of sub_application and app_delegation until record required

with this code i can restore case from anywhere to anywhere

Code: Select all

foreach($GLOBALS['gridHistory'] as $cuurentTask)
{
      $cuurentTask["PRO_UID"] =$dbHandle->Convertnumber2english(trim($cuurentTask["PRO_UID"]));
      $cuurentTask["TAS_UID"] =$dbHandle->Convertnumber2english(trim($cuurentTask["TAS_UID"]));
      $cuurentTask["DEL_INDEX"]=$dbHandle->Convertnumber2english(trim($cuurentTask["DEL_INDEX"]));
      
      if($cuurentTask["PRO_UID"]!==$to_PRO_UID || $cuurentTask["TAS_UID"]!==$to_TAS_UID || $cuurentTask["DEL_INDEX"]!==$to_DEL_INDEX)
      {
         $task_type=task_type($cuurentTask["TAS_UID"],$cuurentTask["PRO_UID"]);
         
         $inPath=checkForExistInPath($to_APP_UID,$cuurentTask["APP_UID"],$to_DEL_INDEX,$cuurentTask["DEL_INDEX"]);
            
         if($task_type=="NORMAL" && $inPath )
         {      
               if(rollbackAppDelegate($cuurentTask["APP_UID"],$cuurentTask["DEL_INDEX"])!=1)
                  die('خطا در بازگرداندن کار نرمال '.$cuurentTask["APP_UID"]);
         }
         else if($task_type=="SUBPROCESS" && $inPath)
         {
            $sub_application=$baseClass->query("select APP_UID from sub_application where app_parent='".$cuurentTask["APP_UID"]."' and DEL_INDEX_PARENT='".$cuurentTask["DEL_INDEX"]."'");
            if(deleteSubProcess($sub_application[0]["APP_UID"])!=1)
               die('خطا در حذف زیر فرآیند'.$sub_application[0]["APP_UID"]);
            if(rollbackAppDelegate($cuurentTask["APP_UID"],$cuurentTask["DEL_INDEX"])!=1)
               die('خطا در بازگرداندن کار موازی'.$cuurentTask["APP_UID"]);
         }
         else
            echo 'امکان انتقال وجود ندارد.';
      }
      else
      {
         if($APP_CUR_USER=$baseClass->query("select USR_UID from app_delegation where app_delegation.APP_UID='{$cuurentTask['APP_UID']}' order by DEL_INDEX desc LIMIT 1"))
            if($baseClass->query("update app_delegation set DEL_THREAD_STATUS='OPEN' , DEL_FINISH_DATE=null where  app_delegation.APP_UID='{$cuurentTask['APP_UID']}' and app_delegation.DEL_INDEX='{$cuurentTask["DEL_INDEX"]}';"))
               if($baseClass->query("update application set APP_STATUS='TO_DO' , APP_FINISH_DATE=null,APP_CUR_USER='{$APP_CUR_USER[0]["USR_UID"]}' where  application.APP_UID='{$cuurentTask['APP_UID']}';"))
               {
                  echo 'true';
                  break;
               }
               else
                  echo 'false';
      }
رمضان کریم است
[email protected]

touhamm
Posts: 18
Joined: Mon Jul 25, 2016 11:55 am
Country: Morocco

Re: roll back a case to previous step

Unread postby touhamm » Tue Jul 26, 2016 9:35 am

Hi ashkufaraz,

Where do you run this code? I need to roll back a case but I should not access it. In my use cases, roll backs are requested by users who make mistakes and want to go a step back to correct it. If I need to step in and enter the trigger my self, then I would be involved in the case while I should not.

Regards.


Return to “Code”

Who is online

Users browsing this forum: No registered users and 1 guest