Siebel Object Interfaces Reference > Interfaces Reference > Business Component Methods >
SetFieldValue assigns the new value to the named field for the current row of the business component.
BusComp.SetFieldValue FieldName, FieldValue
String containing the name of the field to assign the value to
String containing the value to assign
This method can be used only on fields that are active. For details, read ActivateField Method. For applications in standard interactivity mode, write the record immediately after using SetFieldValue by calling WriteRecord.
FieldName must be enclosed in double quotes, and must be spelled exactly as the field name appears in the Siebel Repository (not in the status line of the application or the list column header), with the correct case; for example,
SetFieldValue "Name", "Acme"
FieldValue must not have a length that exceeds the defined length of the field. For example, passing a 20 character string into a field that is defined as being 16 characters long results in the runtime error "Value too long for field 'xxxxx' (maximum size nnn)." A good practice is to check the length of the string against the length of the destination field before using SetFieldValue.
To set a field to null, follow this example:
SetFieldValue "Name", ""
Do not use the SetFieldValue method on a field that has a pick list. Instead, use the following procedure.
- Use GetPicklistBusComp(...) to get a reference to the picklist business component for the Last Name field.
- Set the required SearchSpec on the pick list business component so that a single unique record is returned.
- Execute the query on the pick list business component.
- Call the Pick method to emulate the user picking the record.
NOTE: SetFieldValue cannot be used with calculated fields and cannot be used recursively.
Browser Script, COM Data Control, COM Data Server, Java Data Bean, Mobile Web Client Automation Server, Server Script
The following example is in Siebel VB:
If Val(Me.GetFieldValue("Rep %")) < 75 Then
Me.SetFieldValue "Rep %", "75"
The following is the equivalent example in Siebel eScript:
if (ToInteger(this.GetFieldValue("Rep %")) < 75)
this.SetFieldValue("Rep %", "75");