Siebel Business Process Framework: Task UI Guide > Examples of Developing a Task UI > Example of Developing a Task UI That Assists with Creating Multiple Opportunities >

Creating the Business Service


This task is a step in Example of Developing a Task UI That Assists with Creating Multiple Opportunities.

In this topic, you create the business service that the task UI calls.

To create the business service

  1. In the Object Explorer, click Business Services.
  2. In the Business Services list, create a new record using values from the following table.
    Property
    Value

    Name

    MultiTBC_Insert

    Project

    Multiple Opportunity Task UI

    Class

    CSSService

    Display Name - String Override

    MultiTBC_Insert

  3. In the Business Services list, right-click the MultiTBC_Insert business service, and then choose Edit Server Scripts.
  4. In the Scripting Language dialog box, choose eScript, and then click OK.

    Siebel Tools opens the script editing window and chooses the Service_PreInvokeMethod function.

  5. Make sure the cursor is positioned in the script editing window.
  6. Choose the Edit menu, and then the Select All menu item.
  7. Choose the Edit menu, and then the Cut menu item.
  8. Paste the following script in the script editing window:

    function Service_PreInvokeMethod (MethodName, Inputs, Outputs)

    {

    if (MethodName == "InsertRecordToTBC")

    {

    var currentBC;

    var currentTBC;

    var currentBO;

    var isSuccess;

    var iCounter;

    var indata;

    var isRecord;

    currentBO = TheApplication().GetBusObject ("Opportunity");

    currentTBC = currentBO.GetBusComp ("TBUI81MultiRecordTBC");

    currentBC = currentBO.GetBusComp ("Opportunity");

    //Inserts data in the TBC

    iCounter = 3;

    do

    {

    indata="OptyMTBC"+iCounter;

    currentTBC.NewRecord(0); // creating a new record

    currentTBC.SetFieldValue("OptyName", indata); //setting name field

    currentTBC.WriteRecord(); // writing record in the multirecord TBC

    iCounter--;

    } while(iCounter);

    //Get the data from TBC and insert in BC

    currentTBC.ActivateField ("OptyName");

    currentTBC.ClearToQuery();

    currentTBC.SetSearchSpec ("OptyName", "*");

    currentTBC.ExecuteQuery(ForwardBackward);

    isRecord = currentTBC.FirstRecord();

    iCounter = 0;

    if(isRecord)

    {

    do

    {

    indata = currentTBC.GetFieldValue("OptyName");

    currentBC.NewRecord(0); //This creates the new record

    currentBC.ActivateField("Name");

    currentBC.SetFieldValue("Name", indata);

    // This is setting the field value for opportunity name

    currentBC.WriteRecord(); // writing the record to database.

    iCounter++;

    } while(currentTBC.NextRecord());

    }

    }

    return (CancelOperation);

    }

  9. Close the script editing window, and then click Yes in the Confirm dialog box.
  10. In the Object Explorer, expand the Business Service tree, and then click Business Service Method.
  11. In the Business Service Methods list, create a new business service using values from the following table.
    Property
    Value

    Name

    InsertRecordToTBC

    Display Name - String Override

    MultiTBCInsertBSM

Siebel Business Process Framework: Task UI Guide Copyright © 2018, Oracle and/or its affiliates. All rights reserved. Legal Notices.