How to skip a timer in an active workflow context?

joshuamayes
Giga Expert

I have a workflow with a few (Wait x days) timers.  When I'm testing changes to the workflow I don't want to actually wait that long for this step to complete.  Is there any way I can force the context to move on to the next step?

1 ACCEPTED SOLUTION

Deepak Ingale1
Mega Sage

In workflow timer activity, you can put code like 

// Create a property e.g. with name as "nameOfCustomProperty" and put its value as //disable. when you move to PROD or next instance, change value to "enable"
 if ( gs.getProperty("nameOfCustomProperty") == "disable") {

  // put code here to wait for 2 secs atleast

}else{

  // put code for time you want to wait here in reality and not for testing

}

 

Note: Please mark reply as correct / helpful if it answers your question

 

View solution in original post

8 REPLIES 8

Deepak Ingale1
Mega Sage

In workflow timer activity, you can put code like 

// Create a property e.g. with name as "nameOfCustomProperty" and put its value as //disable. when you move to PROD or next instance, change value to "enable"
 if ( gs.getProperty("nameOfCustomProperty") == "disable") {

  // put code here to wait for 2 secs atleast

}else{

  // put code for time you want to wait here in reality and not for testing

}

 

Note: Please mark reply as correct / helpful if it answers your question

 

joshuamayes
Giga Expert

Hi Deepak, are you proposing a global change to how every timer activity is run, or is this a per-instance change?

How would I even go about editing that?

You can make it a part of every global activity as well, I don't see an issue.

I would create a script include which can be called from timer script and based on property you can turn on and off the real time. In instances where you dont want to wait, you can turn it off, and in instances where you want to behave the way it should, you can turn it on.

 

This will give you flexibility for unit testing

RichardSaunders
Tera Guru

The best way to do this on an individual basis is this..

1. Open Workflow Context > Workflow Executing Activities 

find_real_file.png

2. Select the timer that you would like to skip/force

3. Copy the sys_id from the scratchpad field

find_real_file.png

4. Go to sys_trigger.list

5 Search Name for the sys_id

6. Change the Next action date

find_real_file.png

7. Boom! 

You're welcome! 😄