This might be a very trivial and known thing for people working in Siebel 8.0 workflows from long time. But I wasted around couple of hours for nothing over this. So, thought of posting it here which might help newbie’s save some time if they happen to stumble over same problem.This post is about Siebel Operation step in Siebel 8.0 workflows.
Everybody knows that Siebel Operation step has been armed with new methods such as Next Record, Previous Record, Upsert etc to make our life easier.
The requirement on which I was working required me to:
- Query Service Request Attachment records related to a Service Request
- Run a loop around it
- Perform some operation in a business service on those records.
So, I created a workflow use Query, Next Record operation to loop through records and had a business service step in which output from query operation was passed and some manipulations were done. Basically
Query SR -> Query SR Attachment -> Run BS -> Next Record -> Query SR Attachment
Problem started when the requirement was modified, to update the record after calling the business service. I added an update step in between BS step and Next Record step and workflow stopped looping on records.
Query SR -> Query SR Attachment -> Run BS -> Update Record -> Next Record -> Query SR Attachment
It would exit only after updating the first record.
After struggling for around couple of hours (in which I almost created the workflow again) I noticed that there is another method in addition to Query Method “QueryBiDirectional”. Instead of Query operation I used QueryBiDirectional and the problem was solved.
Searching bookshelf for this method I found the following line
“If the workflow is traversing active records or if your workflow uses the PreviousRecord operation, query bidirectionally. Otherwise, use the standard Siebel query operation.”
I was neither traversing Active Records nor I was using Previous Records but still I had to use QueryBiDirectional to make my workflow work. I am not sure why this happens but the moral of the post is
Use QueryBiDirectional instead of Query whenever you are going to have an update operation in between Query and Next Record.
If anybody knows, why this happens please do share with us!