Siebel Object Interfaces Reference > Interfaces Reference > Business Component Methods >

WriteRecord


Commits to the database any changes made to the current record.

Syntax

oBusComp.WriteRecord

Argument
Description
Not applicable
 

Returns

Not applicable

Usage

After creating new records and assigning values to fields, call WriteRecord to commit the new record to the database.

Used With

Browser Script, Server Script, Mobile/Dedicated Web Client Automation Server, COM Data Control, COM Data Server, Java Data Bean, CORBA Object Manager

Example

This Siebel VB example inserts an activity if the Sales Stage field is set to 02. For other examples, see GetMVGBusComp and NewRecord.

(general) (declarations)
Option Explicit

Sub BusComp_SetFieldValue (FieldName As String)
   ' Run this code from the Opportunities Activities view.
   ' Opportunity is presumed to be the parent business component.

   Select Case FieldName
      Case "Sales Stage"
      if Me.GetFieldValue(FieldName) LIKE "02*" Then
         ' reference the Action business component
         Dim oBCact as BusComp
         Set oBCact = me.BusObject.GetBusComp("Action")
         With oBCact
            .NewRecord NewAfter
            .SetFieldValue "Type", "Event"
            .SetFieldValue "Description", "THRU SVB, Stage _
               changed to 02"
            .SetFieldValue "Done", Format(Now(), _
               "mm/dd/yyyy hh:mm:ss")
            .SetFieldValue "Status", "Done"
            .WriteRecord
         End With
         set oBCact = Nothing
      end if
   End Select
End Sub

This CORBA example adds a new customer record. The error-handling routines have been omitted for clarity.

int customer::addCustomer(char* fName, char* lName, char* street, char* city, char* state, char* zip, SiebelApplication* pSeblApp) {

   SiebelBusObject* pBusObj;
   SiebelBusComp_ptr pBusComp;
   short err = 0;

   pBusObj = pSeblApp->GetBusObject("Contact");
   pBusComp = pBusObj->GetBusComp("Contact");

   //Activate necessary fields for customer look-up
   try
   {
      pBusComp->ActivateField("First Name");
      pBusComp->ActivateField("Last Name");
      pBusComp->ActivateField("Personal Street Address");
      pBusComp->ActivateField("Personal City");
      pBusComp->ActivateField("Personal State");
      pBusComp->ActivateField("Personal Postal Code");
   }

   //Create new record
   try
   {
      pBusComp->NewRecord(0);
   }

   //Set field values
   try
   

   {
      pBusComp->SetFieldValue("First Name", fName);
      pBusComp->SetFieldValue("Last Name", lName);
      pBusComp->SetFieldValue("Personal Street Address", street);
      pBusComp->SetFieldValue("Personal City", city);
      pBusComp->SetFieldValue("Personal State", state);
      pBusComp->SetFieldValue("Personal Postal Code", zip);
   }

   //Commit record
   try
   {
      pBusComp->WriteRecord();
   }

   return 1;

}


 Siebel Object Interfaces Reference 
 Published: 18 June 2003