GlideForm - setValue(String fieldName, String value)

Sets the value of a field.

When defining a value in a choice list, be sure to use number value rather than the label.

To improve performance by preventing a round trip, include a display value in addition to the value, use setValue(fieldName, value, displayValue).

Note: The method setValue() can cause a stack overflow when used in an OnChange client script. This is because every time the value is set, it will register as a change, which may re-trigger the OnChange client script. To prevent this, perform a check that will validate that the new value will be different from the old value. For example, before performing setValue(shortDesc, newValue.toUpperCase());, validate that the short description is not already uppercase. This will prevent the client script from applying the toUpperCase() more than once.
Table 1. Parameters
Name Type Description
fieldName String Name of the field.
value String Value in the database.
Table 2. Returns
Type Description

g_form.setValue('short_description', 'replace this with appropriate text');