SetFieldValue Method for a Business Component
The SetFieldValue method sets a new value for a field in the current record of a business component. This method does not return any information.
Format
BusComp.SetFieldValue FieldName, FieldValue
The following table describes the arguments for the SetFieldValue method.
Argument | Description |
---|---|
FieldName |
String that contains the name of the field. |
FieldValue |
String that contains the value to set. |
The format for the FieldName argument uses the same format that is described in Format for the Activate Field Method in ActivateField Method for a Business Component.
The length of the FieldValue argument must not exceed the length of the field. For example, if you pass a 20 character string to a field that is defined as 16 characters in length, then Siebel CRM creates a run-time error that is similar to the following:
Value too long for field 'xxxxx' (maximum size nnn).
You must make sure the length of the string you pass is no longer than the length of the destination field.
Usage
You can use the SetFieldValue method only on a field that is active. For more information, see ActivateField Method for a Business Component.
You cannot use the SetFieldValue method with a calculated field. You cannot use the SetFieldValue method recursively.
Used With
Browser Script, 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:
If Val(Me.GetFieldValue("Rep %")) < 75 Then
Me.SetFieldValue "Rep %", "75"
Me.WriteRecord
End If
The following is the equivalent example in Siebel eScript:
if (ToInteger(this.GetFieldValue("Rep %")) < 75)
{
this.SetFieldValue("Rep %", "75");
this.WriteRecord();
}
The following Siebel VB example sets a field to null:
oBC.SetFieldValue "FieldName", ""