Siebel Business Rules Administration Guide > Implementing Rules in Siebel Workflows > Scenario for Using Rules in a Siebel Workflow to Do Batch Processing >

Adding Business Logic


This topic is a task in the development process that is listed in Scenario for Using Rules in a Siebel Workflow to Do Batch Processing.

The business logic requirement is implemented in a business service step that makes a call to the Business Rule Service business service. Business Rule Service calls a rules module that applies the logic that is described in Defining the Business Process Flow.

You must do the following tasks to add the business logic. Except as noted, these tasks are typical for creating and deploying rules from HaleyAuthority.

Creating a Knowledge Base

For this example, if you have already deployed any rules to the runtime database you intend to use, then use your existing knowledge base that points to that runtime database. If you have not deployed any rules, you can use an existing knowledge base or you can create a new knowledge base.

To create the knowledge base

  1. Launch HaleyAuthority by choosing Siebel Business Rules Developer from the Windows program group that contains Siebel Tools.
  2. In the HaleyAuthority dialog box, select New knowledge base file (*.akb).

    NOTE:  For this example, you create an Access knowledge base and connect to a Siebel sample database. For information on using a non-Access database, see Setting Up Your Knowledge Base.

  3. Name the knowledge base, for example KB_1, and click Save.

    HaleyAuthority opens with the knowledge base name in the title bar.

Importing Siebel Objects

You import Siebel object definitions - business objects, business components, and fields - from the Siebel Master Repository in order to create rules modules that reflect the business logic. The business logic for this example is based on the Opportunity business object and Opportunity business component. You also based the Opportunity Rules Batch Processing workflow process on the Opportunity business object.

If this is your first import of Siebel Objects into the knowledge base, you must provide connectivity parameters to the Master Repository and runtime database.

To import Siebel objects and define connectivity

  1. In HaleyAuthority, choose File > Import > Siebel Object.

    Siebel Object Importer Wizard launches.

  2. From the Siebel Object Importer Wizard Welcome screen, click Next.
  3. If this is your first import of Siebel objects into this knowledge base, enter repository and runtime database connection parameters in the Login screen, then click Next. For this example, the Siebel sample database is used for both the repository database and as the runtime database.
    • Specify (or browse to) the Siebel application cfg file (for example, uagent.cfg or siebel.cfg) which points to the applicable database. It is typically located in the \BIN\LANG directory in your Siebel Mobile Web client root directory, where LANG is the language code (for example, ENU).
    • Enter the login credentials to the applicable database.
    • Choose Sample for the datasource.
    • For the runtime data connection, choose Local mode.
  4. In the Pick Task screen, click the Import Siebel objects radio button, then click Next.
  5. From the Pick Business Object screen, select the Opportunity business object from the picklist, then click Next.
  6. in the Pick Business Components screen, click the checkboxes for the Opportunity and Opportunity No Link business components, then click Next.
  7. The Pick Business Component Fields dialog box lists available fields for the Opportunity business component. In the Available Fields list, click to select the Description, Primary Revenue Win Probability, and Quality fields. Click the right arrow to move the selected fields to the Selected Fields list, then click Next.

    NOTE:  You do not have to select the Status field. The Status field is used in a query in a workflow step, but it is not used in the rule module.

  8. Similarly, for the Opportunity No Link business component, select the Description, Primary Revenue Win Probability, and Quality fields.
  9. The Finish screen displays the hierarchy of the business object, business component, and fields to be imported. Confirm to import this hierarchy by clicking Finish.
  10. Click No when prompted whether to perform another task.

    The Output screen displays a log of the concepts, relations, and dictionary objects that are automatically created in HaleyAuthority.

For more detailed information about importing Siebel objects, see Using Siebel Object Importer.

After running the object importer, opportunity, opportunity no link, description, quality, and primary revenue win probability are available as concepts.

If you expand the Concepts hierarchy, you see phrasings that you can use with HaleyAuthority's natural English language editor to reference the imported business components and their fields with your rule statements. These phrasings are generated automatically by the Object Importer and represent the relations between the business components that are imported and their fields that are imported. The phrasings are all of the form a business component name has a field name; for example, an opportunity has a description.

Organizing Business Logic Into Rule Modules

A module is a grouping of rule statements. The business logic in this example requires that you create one module.

To create the rule module

  1. In HaleyAuthority, navigate to the Module Explorer by clicking its tab at the bottom of the screen.
  2. Select Modules & Statements, then choose Object > Add a module, and name the new module Opportunity Batch Processing Rules.

    NOTE:  Alternatively, if you used a different name for the rule module when you defined the RuleModuleName input argument for the Call Rules Engine workflow step in To create the workflow process structure, use that name.

  3. Select the Opportunity Batch Processing Rules module, and choose Object > Add a statement.
  4. In the Edit Statement dialog box, type in the following statement or pick its components, then click OK. Do not capitalize any words, except those that are in quoted strings.

    set "Description" of an opportunity to "Reconcile lead quality and probability %."

    NOTE:  For a set statement, the field name must be quoted and not preceded by an article, such as the or a.

  5. Select the statement you created in Step 4 and choose Object > Is applicable > if.
  6. In the Edit Statement dialog box, type in the following statement or pick its components, then click OK. Do not capitalize any words, except those that are in quoted strings.

    the quality of the opportunity is "1-Excellent" and the primary revenue win probability of the opportunity is less than 70

    NOTE:  1-Excellent must be identical to the field value to which it is being compared. The comparison is case-sensitive and space-sensitive.

  7. Repeat Step 5 and Step 6 to add a second applicability statement:

    the quality of the opportunity is "2-Very High" and the primary revenue win probability of the opportunity is less than 50

    NOTE:  If either if applicability condition is true, the statement executes.

  8. Repeat Step 3 through Step 7 to add the following statement and applicability conditions to the module. The second set is identical to the first set, but applies to opportunity no link.

    set "Description" of an opportunity no link to "Reconcile lead quality and probability %."

    Applicability:

    if: the quality of the opportunity no link is "1-Excellent" and the primary revenue win probability of the opportunity no link is less than 70

    if: the quality of the opportunity no link is "2-Very High" and the primary revenue win probability of the opportunity no link is less than 50

Siebel Business Rules Administration Guide Copyright © 2007, Oracle. All rights reserved.