Show/Hide Toolbars

The following sections demonstrate how to get or set values in List custom fields.

Getting Values in Lists

The EnterpriseEntity.getLookupFieldValue() method retrieves the item selected for a List custom field. You can use this value, which is a LookupItem object, to retrieve the full tree position of the lookup item. The following code provides an example of how you can retrieve the full tree position of a List custom field in the contact object:

contact.getLookupFieldValue("APPT_AAAA_BBBB", "HR Associate").getKey();

In addition to contacts, you can use this code for any objects that extend EnterpriseEntity, such as projects or expenses.

Setting Values in Lists

When you set values in List custom fields, you must include the following information:

The full tree position of the category for the custom field.

The name of the List custom field.

The full tree position of the item in the lookup table.

You can use the EnterpriseEntity.getLookupFieldValue() without the full tree position of the category, as shown in the following code sample.

contact.setLookupFieldValue("HR Associate", "OCCU_ROOT_HURE_HRAS");

If you know the tree position, you can also use it as one of the parameters for the method:

contact.setLookupFieldValue("APPT_AAAA_BBBB", "HR Associate", "OCCU_ROOT_HURE_HRAS");

For a complete sample of custom list fields in Java, see Checking and Setting Values in Custom Fields of Type List.