Not able to start the process in 5 mins interval

Certified Senior Developer

Hi all,

I have a requirement where I need to call a process model in every 5 mins. Also if the minutes are in 5 series like 05, 10, 15... then only further process need to be executed. If I have started the process model at 9" 31 AM" then it should introduce the waittime of another 4 mins and then only execute further.

Current configuration -

1, Start node is configured with the constant -> just to ON and OFF the auto execution.

2.. Tried to find the required time and assigned that as a expression in "Delay until the date and time specified by this expression:" as below - 

a!localVariables(
local!now: now(),
local!minuteNow: minute(local!now),
local!extraMinutes: if(
mod(local!minuteNow, 5) = 0,
0,
5 - mod(local!minuteNow, 5)
),
local!adjustedDateTime: datetime(
year(local!now),
month(local!now),
day(local!now),
hour(local!now),
local!minuteNow + local!extraMinutes,
0
),
local!adjustedDateTime
)

Somehow Start node is not understanding and simply going ahead. The delay is not getting introduced.

How to achieve this?

  Discussion posts and replies are publicly visible

  • +1
    Certified Lead Developer

    Issue with you delay code, datetime values when local!minuteNow + local!extraMinutes exceeds 59.
    The datetime() function will error because 60 minutes is invalid.

    now() + intervalds(0, if(mod(minute(now()), 5) = 0, 0, 5 - mod(minute(now()), 5)), 0)


    if above will not work try this
    a!localVariables(
      local!now: now(),
      local!minuteNow: minute(local!now),
      local!extraMinutes: if(
        mod(local!minuteNow, 5) = 0,
        0,
        5 - mod(local!minuteNow, 5)
      ),
      a!addDateTime(
        startDateTime: datetime(
          year(local!now),
          month(local!now),
          day(local!now),
          hour(local!now),
          0,
          0
        ),
        minutes: local!minuteNow + local!extraMinutes
      )
    )

  • 0
    Certified Senior Developer
    in reply to Shubham Aware

    Thanks for your reply Shubham. It is working now  It is getting triggered in each 5 mins interval. Below is my process model and facing another issue now

    I am getting the schedules dynamically. for example - at 11:45 I have to execute 5 processes - Process 1, Process 2. I am getting that list along with UUID (UUID i have stored in DB). Now when it is 11:45 the start process node gets executed and shows 2 instances. But when I check in monitoring tab it shows me double instances. in this case 4 instances Sharing below MNI setup.

    In monitoring tab- 

    Anything I am missing here?

  • 0
    Certified Senior Developer
    in reply to vijayan544557

    Also this is happening only when process model is automatically triggered after 5 mins. When I manually trigger it.. It behaves properly.

  • 0
    Certified Lead Developer
    in reply to vijayan544557

    Since you see only 1 parent process, the timer is firing correctly. The issue is inside your process flow.
    As i don't have full vision to your problem i can guess,
    Script Task Get List Process to Trigger From Sc... returning different sized arrays based on execution context (timer vs manual). - You can validate this in monitoring and try to fix that because timer based process works in context of System and Manually with your user.