Query and QueryBiDirectional

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.

Requirement:

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:

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.

Solution:

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.

Reason:

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!

6 Responses to Query and QueryBiDirectional

  1. When you do an Update Step Operation within Workflow itself, the first record on which update happened became Active record and hence 'Query' Step stopped working.Thats when your QueryBidirectional came into picture and helped you

  2. Sounds fair enough!!!
    but I always thought by Active record we means current record on UI and defination of bookshelf also suggests the same. Any other thoughts ?? Anybody ???

    • Yes True Active record can be the current record on UI but actually its the instance of the reference we are talking about.
      For example: If we query (using a search spec through script) and the cursor is on the resulting 1st record that will be known as Active record under that instance though its not in UI.
      But in another case when we say Active BO (in script) and find the want to do a GetFieldalue for the same , its the one Active record on UI.
      Hope it helps 🙂

  3. Yes True Active record can be the current record on UI but actually its the instance of the reference we are talking about.
    For example: If we query (using a search spec through script) and the cursor is on the resulting 1st record that will be known as Active record under that instance though its not in UI.
    But in another case when we say Active BO (in script) and find the want to do a GetFieldalue for the same , its the one Active record on UI.
    Hope it helps 🙂

  4. Thanks for the post – v useful!

    I agree with you Neel – Bookshelf is misleading here. “Active records” tends to refer to where you have a UI instance – ie where there is an ActiveBO.

    If that wasn’t the case, there would be no need for Bookshelf to say “If the workflow is traversing Active records”, as it would never be possible to traverse records that weren’t active! It would simply say “If the workflow is traversing records”.

  5. I am facing similar issue in BS. I havea one step WF (no input/output) which is calling a client side BS.That client BS reads a set of record based on some condition , perform some update operation on each record & then move to next record. Entire logic is within While loop & I am traversing the records using NextRecord. Still I am observing that its executing few records at a time & then BS ends. When I am simulating WF again, its executting another set & coming out. No error noticed.

    Pls suggest.

Leave a Reply

Contribute