cancel
Showing results for 
Search instead for 
Did you mean: 
Workflow Hero

Query Did Not Work in Workflow

Jump to solution

I have a workflow that worked just fine until...

Workflow 1: Task goes to manager, manager checks which business lines need to approve the request, workflow queries the fields on the workflow task to get the business lines, then uses those results to query the Roles list to find the individuals for each business line, then routes the request to those individuals.

Change: Added 2 workflows to the workflow task list. The first one (Workflow 2) runs when a task is created, it secures the task so only the site owners and Assigned To can edit it. It also runs if the Assigned To changes. The second one (Workflow 3) runs when the status is Complete and sets the task to read-only. These need to be in place because the Assign To-Do task can be edited after it has been completed. We do not want to change out the task type in this workflow.

What happened: When the workflow queried the fields on the workflow task, it did not return a result and skipped the business line approval. When I manually entered the parameters in the query, it returned the correct result. The workflow also worked just fine before I made the Change.

So why didn't my query work during the workflow? I've isolated it to the specific query that gets the business lines that the manager checked when he completed the task. I think what happened is that Workflow 1 proceeded and tried to query the fields when Workflow 3 was attempting to secure the task and make it read-only.

Note: Querying a read-only task works because I was able to get the result when I manually entered the parameters.

I was not able to duplicate this issue in the Test environment. However, our Test environment is considerably slower and it's possible that Workflow 1 had enough time to query the task before Workflow 3 could run.

I have removed any new instances of Workflows 2 and 3 in Prod, but we do need to secure the tasks, so I will need to add them back in.

Anyone ever encountered this before?

Labels: (2)
0 Kudos
Reply
6 Replies
Workflow Hero

Re: Query Did Not Work in Workflow

Jump to solution

Hi Andrea, it's hard to tell but you might have a race condition with your production environment.  Have you tried using the commit pending changes action in your workflows?  It might not necessarily help in your case because you've got multiple workflows running but is worth a shot.

Cheers,

Chris

Reply
Workflow Hero

Re: Query Did Not Work in Workflow

Jump to solution

Hello,

This really does sound like a race condition.   You can fix most of these types issues by using a "Pause" for action and giving the workflow that needs to finish first time to do exactly that before the next one begins.    If you know the exact timing, you can use the "Start Workflow" action to your advantage as well, this way you don't have to rely on the luck of the timer to execute things the way you hope them to happen.

Hope that helps!

Mike

Reply
Workflow Hero

Re: Query Did Not Work in Workflow

Jump to solution

Andrea,

If the solutions from Chris Ben‌ and Mike M‌ don't work (and good chance they will), then you might consider converting Workflow3 into a scheduled site workflow that runs hourly.  In the site workflow, you could update the list query to also filter on the Modified column to exclude any items that were updated in the last several minutes to ensure it doesn't step on any tasks that workflow1 is still processing.

Hope that helps & Good luck,

-Tom

Reply
Workflow Hero

Re: Query Did Not Work in Workflow

Jump to solution

I wondered if adding a pause might solve the problem. I encountered the same issue with a different workflow in our Test environment and added a 5 minute pause. That seemed to do the trick.

Reply
Workflow Hero

Re: Query Did Not Work in Workflow

Jump to solution

where did you add the 5 minute pause? above or below the query list action?

0 Kudos
Reply
Workflow Hero

Re: Query Did Not Work in Workflow

Jump to solution

After so the workflow task list would have time to process before the workflow continued.

0 Kudos
Reply