Entries from Siebel Essentials tagged with 'Workflow'

Workflow made simple - Part II

...welcome back to Part II of our tour de workflow Let's reiterate the requirement #2 Retrieve total opportunity revenue for an Account Sum up the revenue of the current Opportunities for an Account and write the result to an Account field. This is the prototype workflow. As in part I, Siebel 8.1 was the implementation platform. The workflow itself has the following properties: Business Object: Account Process Properties created: CurrentRevenue, LastRecord, RecordCount, TotalRevenue Get Oppties Step: Business Component: Opportunity Operation: Query Search Spec Expression: "[Account Id]='" + [&Object Id] + "'" Output Args: TotalRevenue = BC Oppty.Primary Revenue Amount RecordCount = Output Argument NumAffRows Decision Step Last Record? yes = Process Property LastRecord = true no = Default Go to next Oppty Step BC: Opportunity Operation: NextRecord Output Args: CurrentRevenue = Opportunity.Primary Revenue Amount (1) TotalRevenue = Expression: [&TotalRevenue] + [&CurrentRevenue] (2) LastRecord = Output Arg: NoMoreRecords (3) Note: Numbers in brackets indicate the sequence of the output arguments Update Account Step BC: Account Operation: Update Field Input Arg: Revenue = Process Property TotalRevenue Note #1: The workflow operates on the Account Business Object with Account BC as the primary BC and Opportunity as a child BC. Note #2: Despite Note #1 it is still necessary to execute a query to get the Opportunites associated with the Account. Note #3: The fairly new Siebel Operation NextRecord (along with its siblings PreviousRecord and QueryBiDirectional) has been introduced in Siebel 8.0. It is the first version that allows us to loop through a record set in a workflow without being outwitted by the complexity of looping. The NextRecord operation has an output argument of NoMoreRecords (true or false) which must be used in a decision step to determine whether the loop has to end or not. Pitfall #1: Adding up the revenue amount requires two process properties. One to get the field value from the BC and the other one to serve as the accumulator. Note the sequence in the NextRecord operation to fill them in the correct order. Hope you enjoyed this small workflow series. If you want more, drop a comment ;-) @lex...

Workflow made simple - Part I

Recently, I had to do some prototyping for typical requirements which led me to the Siebel Workflow framework as a solution. As indicated in a previous post, workflow processes (along with the business services they call) account for almost every piece of functionality and automation in Siebel CRM). So in general it is a good idea to have an eye on workflow when it comes to automation solutions. However, there are some pitfalls for the novice developer that often lead to frustration and even refusal of using workflow. In this and a following post, I will describe two workflows that should serve as examples how to solve common problems in Siebel. These are the requirements 1. Update multiple records (this post) Users should be able to enter a search string to retrieve a list of Accounts and the target value of the Account Status field. The system should then update the Account Status field of all records in the result set to the target value. 2. Retrieve total opportunity revenue for an Account (future post) Sum up the revenue of the current Opportunities for an Account and write the result to an Account field. I implemented both requirements on Siebel 8.1.0.0 Let's have a look at the solution to requirement #1. To be honest, I was surprised at the simplicity of the workflow. It is a really nice example, how the Siebel framework works. The workflow is configured as follows: Business Object: Account Process Properties created: QueryField, Querytext, RecordCount, TargetValue The first Siebel Operation step is configured as follows: BC: Account (No Link) Operation: Query Search Spec Expression: "[" + [&QueryField] + "] LIKE '" + [&QueryText] + "*'" Output: RecordCount = NumAffRows The second Siebel Operation step is configured as follows: BC: Account (No Link) Operation: Update Field Input Argument: Account State = Process Property: TargetValue Pitfall #1: Too complicated approach Siebel Operations inside a workflow which operate on the same BC inherit the context of the previous step, so all you need is one query operation and then the update operation will update all records in the query result set. That's it. Pitfall #2: Problems with the primary BC There is strange behaviour to report when the Siebel Operations use the primary BC of the workflow's Business Object (Account, that is). I used the Account (No Link) BC instead and it worked like a charm. Please don't ask why ;-) Pitfall #3: Externalize the query string How in god's name can someone figure out the query string if she/he is not a complete geek? "[" + [&QueryField] + "] LIKE '" + [&QueryText] + "*'" is built as follows: 1. Parenthesize the value of the QueryField process property in square brackets "[" + [&QueryField] + "]" 2. Append the LIKE operator "[" + [&QueryField] + "] LIKE" 3. Append an asterisk to the value of the QueryText process property and parenthesize it in single quotes "'" + [&QueryText] + "*'" 4. Bring all together "[" + [&QueryField] + "] LIKE '" + [&QueryText] + "*'" Not too difficult - but devilish Note that the Siebel Operations have an output argument which is useful to get the number of affected records. Several tests showed that the workflow updated several hundreds of records in short time....