My career in technology

Riddle: When is an hour not an hour?

Answer: When you are working with SharePoint Designer workflows…

The requirement was to design moving target KPIs.

During the operation of a process, various tasks are assigned to process members. A number of tasks must be completed by the end of the day. In order to achieve this, a certain number of tasks must be completed each hour. The number per hour varies because of task interdependencies and task durations.

Historical data and a process map have provided a target number of completions for each hour of the day. The tasks are listed in a task list on the SharePoint site. KPIs have been designed to use views of the tasks.

The only problem is that the goals for KPIs are set when the KPI is designed. To change the goal, you have to modify the KPI.

The easy fix for this is that the KPIs are stored in a SharePoint list, and you can modify the data in a SharePoint list with a workflow!

Given that the process does not have a required start time (though it does generally use a regular start time), rather than use “Pause Until Date” I decided to go with “Pause for Duration”. The number of target task completions (“KPI Goal Threshold” and “KPI Warning Threshold”) is supposed to be updated every hour, so I set the duration as 1 hour.

Remember the pause for zero minutes trick? Zero minutes waits until the next update period, which happens every five minutes. When you pause for duration, it waits until the next update period before doing anything, then takes actions (in this case, updating the KPI list items) and pauses for another hour. While those actions don’t take a lot of time, the pause starts enough after the update that after waiting for an hour it just misses the update and has to wait for the next one.

Let’s say the first update happens at 1:00. It takes one second to complete the change to the KPI, so the pause begins at 1:00:01. It pauses for an hour. At 2:00, SharePoint looks for updates, finds none. At 2:00:01 the pause ends. At 2:05, SharePoint looks for updates and process the update, finishing at 2:05:01. Then it pauses for an hour. At 3:00 there is no update, and at 3:05 there is no update. At 3:05:01 the pause ends… and so on.

When is an hour not an hour? When it is 55 minutes.

The solution is to wait 55 minutes instead of an hour.

More posts about SharePoint.

Advertisements

Comments on: "When an Hour Isn’t – SPD Workflows" (3)

  1. Just to clarify –

    Workflow pause for duration is on a timer job that is set for five minutes by default.

    http://sharepointresourcecenter.com/sharepoint-workflow-actions-pause-for-duration.html

    Similarly, workflow e-mails and alerts are also on a five-minute-by-default timer job.

    http://social.technet.microsoft.com/Forums/en-US/sharepointadmin/thread/192c6f0f-7ded-4163-b57c-1355e9077bc2

    Please note that changing the frequency of the timer job will impact performance.

    • manikkam said:

      hi ,

      for me the pause for duration is not working.

      • Possibly may be that the timer job isn’t running or is failing. Any other symptoms that might help me to narrow things down? What version of SP are you on?

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: