Skip activity in workflow

Community Alums
Not applicable

Hi All,

Can i skip the timer activity in the currently running workflow context? Please let me know if we have any such option.

Thanks and Regards,

kirti

6 REPLIES 6

Jogen
Tera Expert

Hi Kirti,



If I am not getting wrong you can remove the timer if you want to skip it. If you just want to test by skipping the timer you can set the timer condition to 1 or 2 sec and wait and test by skipping the timer.



Thanks.


Community Alums
Not applicable

Hi Jogendra,



Iam talking about active running workflow context.It has stopped near the timer activity but i want the flow to move to the next activity.



Regards,


kirti


Jogen
Tera Expert

No there is no way to skip the timer. You have to wait for the timer to get over and move to the next task or phase. If you checkout and edit the workflow and set the timer time to 2/3 sec or remove the timer. Now publish the workflow and request a new task.



Your timer will be skipped. This is used in testing purposes too.



Please let me know if I have answered your question or you want more information on this.



Have a good day.



Jogendra.


Kalaiarasan Pus
Giga Sage

This is a sample code for cancelling the timer activity ...



var CancelTimerFunction = Class.create();


CancelTimerFunction.prototype = Object.extendsObject(AbstractAjaxProcessor,{


     


      CancelTimerActivity: function(ritmSysID){


              var timerSysID = "";


              var timerName = "";


             


              if( !gs.nil(ritmSysID) ){


                      var WFTimer = new GlideRecord("wf_executing");


                      WFTimer.addQuery("context.id", ritmSysID );


                      WFTimer.addEncodedQuery("activity.activity_definition.name=Timer");


                      WFTimer.query();


                      if( WFTimer.next() ){


                              timerSysID = WFTimer.sys_id;


                              timerName = "WFTimer"+timerSysID;


                             


                              if(!gs.nil(timerName)){


                                      var timer = new GlideRecord("sys_trigger");


                                      timer.addQuery("name", timerName);


                                      timer.addQuery("document_key", timerSysID);


                                      timer.query();


                                      if(timer.next()){


                                              timer.deleteRecord();


                                      }


                                     


                                      /*Add entry to WF History table*/


                                      var wf_history = new GlideRecord("wf_history");


                                      wf_history.initialize();


                                      wf_history.activity = WFTimer.activity;


                                      wf_history.contextd = WFTimer.context;


                                      wf_history.state = "cancelled";


                                      wf_history.activity_index = WFTimer.activity_index;


                                      wf_history.workflow_version = WFTimer.workflow_version;


                                      wf_history.started = WFTimer.started;


                                      wf_history.ended = gs.nowDateTime();



                                      /*Add entry to WF History table*/


                                     


                                      WFTimer.state = "cancelled";


                                      WFTimer.update();


                                      wf_history.update();


                              }


                      }


              }


      }


});