I am back with an interesting interview question that I have been asking in past few interviews that I have taken and surprisingly nobody has been able to answer it correctly.
It is quite a simple question and answer is even simpler but people are just not aware of it.
Create a workflow that will query Opportunity with status as “Won” and then update the status of these opportunity records to “Closed”.
*Need to accomplish this inside the workflow without using any kind of script.
Usually candidates are able to answer till the query part which is using the Siebel Operation “Query” Step but they are stumped at the part of updating “Multiple Records” inside workflow as there is no looping mechanism available inside workflow (till Siebel 7.x). So, usually they say that we need to invoke a business service which will loop through records and update.
Actual answer is that you just need to use “Siebel Operation” step again with “Update” operation and Siebel will update all the records that are returned by “Query” step.
This behavior is possible due to Business Component that we give in “Siebel Operation” step and Siebel is able to maintain the BC context created by Query method and update method uses this context to udate all the records returned by Query method
I found a really good post explaining this with help of an example workflow.