Methods for the Field Object

The following table describes the methods that are available for the Field object. These methods are used in the getting and setting of field values and in the color coding of field colors.

For information about finding the field names that you must use when working with these methods, see Finding Field Names.

Table Methods for the Field Object

Method Name Return Type Description Notes Sample Code

getField(fieldName)

A field object exposing the getValue and setValue methods or null, if the field is not found on the screen

Gets the field on the current screen that is identified by the fieldName parameter.

For information about the ListRow getField() method, see the table in Methods for the ListRow Object.

oraclecrmod.getField('Parent Account Name');

getValue()

The field value string

Gets a value for a field in the current screen.

For a check box field, the return values are Y for selected, and N for deselected.

oraclecrmod.getField('Location'). getValue();

getLICValue()

The field’s language independent code (LIC) value as a string

Gets the LIC value for a field in the current screen.

For more information, see Getting and Setting LIC Values of Picklists.

oraclecrmod.getField("Type"). getLICValue(); 

setValue (fieldValue)

The new field value string that was just set, or null if the method fails

Sets a value for a field in the current screen. This can be a New page, an Edit page, a Detail page, or a List page.

For information about the limitations of setValue(), such as field types not supported, see Limitations When Using the setValue() Method.

Note: On Detail pages, and for lists, setValue() does not commit values to the database and update the screen. The commitValues() method must be called to commit the values. See the tables in Methods for the Form Object and Methods for the List Object.

For a New, Edit, or Detail page:

oraclecrmod.getField('Type'). setValue("Customer"); 

For a list, including a related item list:

oraclecrmod.getList ("AccountList").getRow(0).getField ("Type").setValue(" Customer");

setLICValue(fieldValue)

The new language independent code (LIC) field value string that was just set, or null if the method fails

Sets a LIC value for a field in the current screen.

The LIC value is used to set the field’s value. The language dependent code (LDC) value will still be displayed on the screen.

For more information, see Getting and Setting LIC Values of Picklists.

oraclecrmod.getField('Type'). setLICValue("Customer"); 

For a Detail page:

oraclecrmod.getField("Priority"). setLICValue("Low"); oraclecrmod.getField("Region"). setLICValue("West");
oraclecrmod.getForm(). commitValues(commitValuesHandler ); 

setColor(JSONObject)

this

Sets the colors for a Field by passing in a JSONObject.

Elements supported in the JSONObject:

  • labelBgColor. The field label background color.

  • labelTextColor The field label text color.

  • valueBgColor. The field value background color.

  • valueTextColor. The field value text color (not applicable on Edit pages).

Any other elements are ignored.

For information about the color values the elements can have, see Color Values for JSONObjects.

field.setColor({" labelBgColor":"Red", "labelTextColor": "Yellow", "valueBgColor":"Yellow",
"valueTextColor":"Red"});

getColor()

JSONObject

Returns the JSONObject that was set for color coding the field.

If no JSONObject was set using setColor(), getColor() returns the colors based on the system or theme colors.

The getColor() method always returns RGB values or "transparent".

On Edit pages, text color values are not returned.

Text color values are not returned for field types that are not text based, such as check boxes or visual indicators.

color = field.getColor(); 

getId()

String

Returns the row ID of an associated record based on the associated record field displayed on the screen.

The getId() method is supported on Detail, Edit, and List pages. For New pages, it returns null.

The getId() method on a field only works for associated record fields and returns null for other types of fields.

Multi-association fields are not supported, for example, the Users and Contacts fields of Activity.

For example, if an Account’s Primary Contact field is on the screen, then to return the Primary Contact ID value:

getField("Primary Contact").getId(); 

For an associated record on a List page:

oraclecrmod.getList().getRow(0). getField("Owner").getId(); 
Note: For fields like Modified that have a user name link and a date, getColor() returns the user name link color. However, setColor() can set the color on both the link and text.