<Flow> - BPL & Workflow Operation

Solapas principales

HI All,

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??




Tasks contain session reference so you can simplify your query to:

TaskStatus_Request As ID
FROM EnsLib_Workflow.TaskResponse
WHERE TaskStatus_SessionId = ?

For debugging: add hang 1 before executing SQL. What happens?

What do you want to do with ID?

Hi Eduard,

The query is not a problem as the same query runs fine when we run on sql browser via smp. 

There is one flow with two threads

1. Goes and calls a workflow operation , thus creating the workflow task response etc.

2. Hang (Delay in BPL) for few seconds and then calls the query with session. And this query gives null result. But same query with same parameters runs fine in sql browser.

We are going to open the task request object with the id and persist its values for audit trail / historical data / reporting (it will be a mix of task request / response values + lot of others). As long as we get the TaskRequest ID we are good

May be is there a simple example with just one flow, 2 sequences as explained above? 

Neerav, have you tried logging the session ID that you're passing to the query in the BPL? I only suggest this in order to rule out the possibility that the BPL code is failing to get the correct session ID and that's why the query is not returning any results.

Yes Marc.  It logs fine as well and can see it in the visual trace too in the message header values.

There could be two issues:

  • Race condition
  • SQL error

For race condition you need to compare the time when the query is executed to the time when Workflow objects are created.

For sql construct query as a string and trace that.