Oracle CRM On Demand JavaScript API Developer's Guide > JavaScript API Reference > Methods for the Field Object >

Getting and Setting Screen Values


You can use the getValue() and setValue() methods to get and set values for fields on the current screen. The methods are supported for New and Edit pages, and also for Detail pages (including related information sections) and lists (including related item lists). For information about the getValue() and setValue() methods, see Table 5.

Using the setValue() method on Detail pages or List pages is similar to inline editing in the Oracle CRM On Demand UI. When you use the setValue() method for Detail pages and List pages, the value is not set and updated in the database immediately. You must use a commitValues() method to commit the setting of values on Detail or List pages. For information about the commitValues() method, see Table 6 and Table 7.

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

Limitations When Using the setValue() Method

The setValue() method is not supported for the following types of field:

  • Analytics fields
  • Color fields (that is, fields used for color definitions in themes)
  • Currency code fields
  • Multi-association fields
  • Shared address fields
  • Single-association fields for which the Auto-Resolve Enabled check box is deselected. Such fields are grayed out on the UI.

If you call setValue() for the above field types, null is returned.

Single-association fields and fields such as Sales Stage (on Opportunity) only support setting by row ID on Detail pages.

Concatenated fields are not supported, but you can set the values for constituent fields of concatenated fields for both Detail and Edit pages, regardless of whether the fields are on the page layout.

For a check box field, only the values Y or N are accepted for the input parameter. Any other values are ignored.

Support for Address Fields When Using the setValue() Method

For addresses on both Edit and Detail pages, you can change the Country field using the setValue() method and at the same time set other fields in the address layout relevant to the new country setting.

The field names for address fields have the format:

ParentAddressName.ChildAddressName

For example, for an Account billing address Country field:

Parent Bill To Address.Bill To Country

As a code example, you might change the country from Canada to USA, then set the state as follows:

oraclecrmod.getField("Parent Bill To Address.Bill To Country").setValue("USA"); oraclecrmod.getField("Parent Bill To Address.Bill To State").setValue("NY"); oraclecrmod.getForm().commitValues(Handler);

Oracle CRM On Demand JavaScript API Developer's Guide, Release 38 Copyright © 2019, Oracle and/or its affiliates. All rights reserved. Legal Notices.