ActivateField Method for a Business Component

The ActivateField method activates a field. This method does not return any information. You must use the ActivateField method to activate a field before you can perform a query for the business component. For more information, see DeactivateFields Method for a Business Component.

Caution: Do not use the ActivateField method to activate a field in a UI context business component. This technique might cause unexpected Siebel application behavior. For more information about UI context objects, see Doc ID 477419.1 on My Oracle Support.

Format for the Activate Field Method

BusComp.ActivateField(FieldName)

The following table describes the arguments for the ActivateField method.

Argument Description

FieldName

String variable or literal that contains the name of the field.

You must enclose the FieldName argument in double quotes. The value you enter for the FieldName argument must match exactly the field name that displays in Siebel Tools, including the same case. For example:

ActivateField("ActivityCreatedByName")

Usage for the ActivateField Method

By default, a field is inactive except in the following situations:

  • The field is a system field, such as Id, Created, Created By, Updated, or Updated By.

  • The Force Active property of the field is TRUE.

    If you write an event handler on a business component, then you must use the ForceActive user property on the control to make sure the field is active. For more information, see Siebel Developer's Reference.

  • The Link Specification property of the field is TRUE.

  • The field is included in an applet, and this applet references a business component that is active. For a field in a list applet, the Show In List list column property is TRUE.

  • Siebel CRM calls the ActivateField method on the field, and then runs the ExecuteQuery method.

Note the following:

  • If Siebel CRM activates a field after it queries a business component, then it must requery the business component before the user can access the value in that field. If Siebel CRM does not requery the business component, then it returns a value of 0.

  • If Siebel CRM calls the ActivateField method after it calls the ExecuteQuery method, then the ActivateField method deletes the query context.

  • The ActivateField method causes Siebel CRM to include the field in the SQL statement that the ExecuteQuery method starts. If Siebel CRM activates a field, and then if a statement in the GetFieldValue method or the SetFieldValue method references the file before Siebel CRM performs a statement from the ExecuteQuery method, then the activation has no effect. The query contains an empty value because Siebel CRM does not return the activated field through this query.

  • Siebel CRM does not restrict the maximum number of fields that the ActivateField method can activate. This number depends on the SQL query limitations of the database that your deployment uses.

Avoiding a Corrupted Database

If Siebel CRM does not activate a field before it performs a WriteRecord command, then it writes data to the Siebel database, but a corruption problem might occur if a mobile user synchronizes. This situation applies only to mobile users.

To avoid a corrupted database

  1. Use the ActivateField method to call a field.

  2. Call the ExecuteQuery method.

  3. Call the WriteRecord method.

Using this sequence makes sure Siebel CRM writes the field correctly to the transaction log. During synchronization, it saves any modifications that the mobile user makes back to the Siebel database correctly.

Used With

COM Data Control, COM Data Server, Siebel Java Data Bean, Mobile Web Client Automation Server, Server Script

Examples

The following example is in Siebel VB. For an equivalent Siebel eScript example, see ClearToQuery Method for a Business Component:

Dim oEmpBusObj As BusObject
Dim oEmpBusComp As BusComp
Dim sLoginName As String

Set oEmpBusObj = TheApplication.ActiveBusObject
Set oEmpBusComp = oEmpBusObj.GetBusComp("Employee")
oEmpBusComp.SetViewMode AllView
oEmpBusComp.ClearToQuery
oEmpBusComp.SetSearchSpec "Login Name", sLoginName
oEmpBusComp.ExecuteQuery ForwardBackward
Set oEmpBusComp = Nothing
Set oEmpBusObj = Nothing