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

This solution was very helpful to my issue where I wanted to kick out change tasks early because the team updated their planned start date.  The twist to this solution was that I had "nested" workflows running to find the timer task in.  

In the primary change workflow, I found the linked workflow under "Workflow Contexts".  Once I opened that workflow context, I could see the Workflow Executing Activities and get the sys_id from the scratchpad.  Found that right away in the sys_trigger list and then changed the next action time.

Thanks!

This is a great answer, much better than the accepted solution. It does exactly what was asked, rather than suggesting a workaround.

Helped me in the same situation, I just wanted to move a workflow context past a lengthy timer activity for testing. Thanks!

I would prefer this solution honestly. Nothing wrong in the accepted solution - just that it would involve modifying production code (which ideally should always be avoided) which will then need to be peer reviewed before deployment. This one skips that step entirely.

RichardSaunders
Tera Guru

Thank you, glad you found it useful. 

@joshuamayes should change it to 'Correct Answer' 😉