Siebel Business Rules Administration Guide > Implementing Rules in Siebel Task-Based UI > Scenario for Using Rules to Provide Dynamic Navigation in a Siebel Task >

Adding Business Logic


This topic is a task in the development process that is listed in Scenario for Using Rules to Provide Dynamic Navigation in a Siebel Task.

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:

  • Determines whether a lead is Excellent, Very High, or Default. This return value is assigned to a task property that is used in the decision branching to guide the user along the applicable path of the task flow.
  • Sets the quality field for the opportunity to 1-Excellent, 2-Very High, or 3-Default.

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, assume this is the first knowledge base created for this application.

To create the knowledge base

  1. Launch HaleyAuthority.
    • By default, launch 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 TestCallBack, 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 Create a Lead task on the Opportunity business object.

On your first import of Siebel Objects into the knowledge base, you 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. In the Login screen, enter database connection parameters, then click Next. For this example, the sample database (sse_samp.dbf) 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 checkbox for the Opportunity business component, 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 Name, Revenue, and Quality fields. Click the right arrow to move the selected fields to the Selected Fields list, then click Next.
  8. 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.
  9. 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.

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 revenue.

How the Multi-Value Revenue Field is Imported

Revenue is a multi-value field (MVF) on the Opportunity business component with a primary value. Revenue field values are derived from a link between the Opportunity and Revenue business components as follows:

  • The Opportunity's Revenue field derives its values from the child Revenue business component's Revenue field for the records in the link.
  • One of the values in the Opportunity's Revenue field is the primary revenue. It is defined by the Primary Revenue Id field on the Opportunity business component.

Like other multi-value fields with a primary record, the Object Importer recognizes the link and creates the concepts and relations as described in Table 13.

CAUTION:  For this example, three of the Siebel objects that take part in this import have the same name, which is not a typical scenario. Table 13 attempts to explain their roles clearly.

Table 13. Concepts and Relations Created by Object Importer for an MVF with a Primary
Concept or Relation
Concept or Relation Created in this Example
Explanation

concept:
business_component

opportunity

 

concept:
child_business_component

revenue

This is the Revenue child business component, and not the Revenue field on Opportunity.

concept:
child_business_component
_destination_ field

revenue

This is the Revenue field on the Revenue child business component, and not the Revenue field on the Opportunity business component.

NOTE:  There is only one revenue entity after the import, although it is created to represent two different objects. However, it contains all the relations applicable to both contexts. Notice that the import log indicates two lines stating that the revenue concept is created.

concept:
primary child_business
_component

primary revenue

This concept is created as a child concept to the concept representing the child business component in the link. That is, primary child_business
_component
is a type of child_business_component.

relation:
a business_component has a child_business
_component

an opportunity has a revenue

Again, note that revenue in this relation is the Revenue child business component in the link, not the Revenue field on Opportunity.

relation:
a child_business
_component
has a child_business_component
_destination_ field

a revenue has a revenue

The Revenue child business component has a Revenue field.

relation:
a business_component has a primary child_business
_component

an opportunity has a primary revenue

Again, note that revenue in this relation is the Revenue child business component in the link, not the Revenue field on Opportunity.

When you write a HaleyAuthority rule statement that refers to the value of a multi-value field, in this example an opportunity's revenue, you instead use the following construct, using the concepts and relations that are explained in Table 13. The construct essentially provides the path to the primary value:

a business_component's primary child_business_component's child_business_component_destination_field

For this example, you would use:

an opportunity's primary revenue's revenue

Organizing Business Logic Into Rules Modules and Submodules

Your business logic may have natural groupings of rules. The groupings may organize your logic sequentially, by applicability, or for some other purpose.

For this example, the business logic is naturally grouped by the three qualities that a lead may qualify for. The business logic to render as rule modules is the evaluation of the quality of a lead.

A module is a grouping of rule statements. A submodule is a grouping of statements within a module.

To create modules and submodules

  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 New Lead.
  3. With the New Lead module selected, choose Object > Add a submodule, and name the new submodule Excellent.
  4. Repeat Step 3 to create two more submodules to the New Lead module. Name them Very High and Default.

Now you add statements to each submodule to execute your business logic.

To add statements to submodules

  1. Select the Excellent submodule, and choose Object > Add a statement.
  2. In the Edit Statement dialog box, type in the following statement or pick its components (except quoted strings, which you must type in) from the Words picklist, then click OK. Do not capitalize any words, except those that are in quoted strings.

    if an opportunity's primary revenue's revenue is at least 2000000 in "USD" then set "Quality" of the opportunity to "1-Excellent" and add "Excellent" for the opportunity

  3. Verify that your statement is understood by HaleyAuthority. If it is not understood, a question mark is displayed at the beginning of the statement when it is displayed in the Module Explorer. If your statement is not understood, choose Object > Reparse statement. If the statement is still not understood, choose Object > Edit, and make changes so that the statement matches the direction in this procedure.

    The statement you added includes the following components:

    Statement Component
    Purpose

    if

    Provides conditional context

    an opportunity's

    The current opportunity

    primary revenue's revenue

     

    The primary revenue amount

    For information on the concepts and relations that are created by Object Importer for a multi-value field with a primary, and an explanation of its application to this example, see How the Multi-Value Revenue Field is Imported.

    is at least 2000000 in "USD"

    Operator evaluates the revenue as an integer literal and its currency code.

    NOTE:  A currency amount must be entered in the form shown, with its currency type included in quotes.

    then

    Establishes the consequent for the conditional statement.

    set "Quality" of the opportunity to "1-Excellent"

    Sets the Quality field on the Opportunity business component's record to the value 1-Excellent.

    NOTE:  The Quality field is based on a list of values (LOV), so the value must be an exact match to evaluate to TRUE.

    and

    Appends another action.

    add "Excellent" for the opportunity

    Adds Excellent as a Derivation value to the output property set that is returned from the rule call if this rule applies and is executed.

     

  4. Repeat Step 1 through Step 3 to add the following statement to the Very High submodule:

    if an opportunity's primary revenue's revenue is at least 500000 in "USD" and an opportunity's primary revenue's revenue is less than 2000000 in "USD" then set "Quality" of the opportunity to "2-Very High" and add "Very High" for the opportunity

  5. Repeat Step 1 through Step 3 to add the following statement to the Default submodule:

    if an opportunity's primary revenue's revenue is at least 1 in "USD" and an opportunity's primary revenue's revenue is less than 500000 in "USD" then set "Quality" of the opportunity to "3-High" and add "Default" for the opportunity

Lead Quality
Revenue

Excellent

$2,000,000 and greater

Very High

At least $500,000 and less than $2,000,000

Default

At least $1 and less than $500,000

The rules create the following matrix:

This example does not illustrate testing the rule module with the HaleyAuthority test harness before deploying the rule module. Instead, see Testing Rule Modules for an alternate testing strategy for the rule module and the Business Rule Service business service. For information and examples of using the test harness, see Using the HaleyAuthority Test Harness, Scenario for Using Rules to Validate Data at Runtime, or Scenario for Using Rules in a Siebel Workflow to Do Batch Processing.

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