Is it possible to put a pause in a flow

 5 Replies
 2 Subscribed to this topic
 52 Subscribed to this forum
Sort:
Author
Messages
Todd Mitchell
Veteran Member
Posts: 87
Veteran Member

    I am writing a flow that Deactivates a File Channel then performs some other functions.  I would like to add a pause after the channel is deactivated to allow potential work units to finish before I perform the other functions.   How would your recommend doing this pause -- say for 2 minutes?

     

     

    Tim Cochrane
    Veteran Member
    Posts: 154
    Veteran Member
      Depends which version of IPA you're running.

      Anything after 10.1.1.x (i don't recall the which sub version) has a "Wait" node available, under the Control items. You can accomplish the same thing in previous versions that don't have the wait node, by adding a js function in pflow.js that calculates a timeout, then call that function from your flow.

      Tim Cochrane - Principal LM/IPA Consultant
      Shane Jones
      Veteran Member
      Posts: 460
      Veteran Member
        If you are on a version before the wait is available you can do this within an assign node without changing your pflow.js file. Just add a JavaScript command and then call it right after that. I am pulling the command for you.
        Shane Jones
        Tools: HR, Payroll, Benefits, PFI, Smart Office, BSI, Portal and Self-Service
        Systems: Lawson, Open Hire, Kronos, Crystal Reporting, SumTotal Learning
        ** Teach others to fish...
        Shane Jones
        Veteran Member
        Posts: 460
        Veteran Member

          Add this in an ASSIGN node as JavaScript:

           

          function startPause(mill, tdiff)
          {
          var lastdate = new Date();
          var currdate = null;
          var tdiff = 0;

          do { currdate = new Date();
          tdiff = currdate-lastdate; }
          while(currdate-lastdate < mill);
          return tdiff;
          }

          Then after adding a double variable type call the javascript into the variable like this:

          startPause(60000, 0);

          Shane Jones
          Tools: HR, Payroll, Benefits, PFI, Smart Office, BSI, Portal and Self-Service
          Systems: Lawson, Open Hire, Kronos, Crystal Reporting, SumTotal Learning
          ** Teach others to fish...
          Tim Cochrane
          Veteran Member
          Posts: 154
          Veteran Member
            If you're only adding a handful of "waits" total, DEF add the js to the Assign node...if you're doing many i would recommend maintaining the code in one location. i've seen 6-8 "wait" called in 20 different flows, so it was easier just to add in one location, test it once, then reference in the assign...just my $.02
            Tim Cochrane - Principal LM/IPA Consultant
            Derek
            Basic Member
            Posts: 9
            Basic Member
              I use a system command and call: sleep 120 (for AIX) or timeout 120 (Windows). This doesn't chew CPU cycles.