It seems pretty straight forward in theory and I assumed it will be too, but may be I am missing some simple step in implementation.
Here is the scenario of our business process
We enter a BP
There is a flow
Flow 1 -
Step 1 :Calls a Workflow Operation "ABC" - thus creating a workflow task etc. And is now waiting for user to finish the workflow task created.
Flow 2 -
Step 1 :Does a delay of few seconds
(As flows don't have a certain order to execute, so delay is to make sure that the Workflow operation has got enough time to do it's thing to create tasks etc)
Step 2 :Does a SQL to fetch the EnsLib_WorkFlow.TaskRequest ID that was created by running a query against EnsLib.MessageHeader
which is something like "Select MessageBodyId from MessageHeader where msgclasss='Enslib.Workflow.TaskRequest' And QueueName = 'ABC' and Session = .. (We pass the sessionid of the session which created the workflow task )
I have written the query from my memory, so most probably has some errors, but the one in code is running perfectly.
So query is not the problem
Problem is Step2 in the Flow 2 always gives null as a result , but same query in sql browser with same parameters gives a valid result.
In visual trace also we can see that the Delay called the sql much after workflow was created, we even tried the delay to be 1 minute. so delay is not the problem either
Any suggestions from experience??