Using Fields in Web Service Requests

When using fields in web service requests, there are some recommended best practices that you should follow to achieve optimal performance. Review this topic to understand the recommendations and constraints when including fields in a web service payload.

Which Fields Can Be Included in a Web Service Payload?

When creating a field in Application Composer, you can set the Include in Service Payload option. This option specifies whether or not the field value can be included in a web service request or response.

Long Text Field (CLOB)

Generally, long text fields are exposed only in detail pages. However, in web service calls, these fields are part of the response payload. Therefore, minimize usage where possible.

If you're going to use long text fields, then follow these recommendations:

  • Limit the number of long text fields to two per object, when you use long text fields in web service calls.

  • Avoid using a long text field for a text attribute, unless it needs to hold large values.

  • Don't use long text fields in web service calls unless absolutely needed. These fields are high memory-consuming candidates.

Dynamic Choice List Fields

Including dynamic choice list (DCL) fields in a payload can impact the web service response time because it requires additional queries to fire. When you work with DCL fields, follow these recommendations:

  • Limit the number of DCL fields included in a service payload to four fields.

  • Use a good data filter to limit the number of records in the list of values (LOV).

  • Only create a DCL field when absolutely needed to meet the business requirement.

  • To access the object referenced by a DCL field through Groovy, use the respective DCL field's secondary Related Object Accessor field.

    See Using the Related Object Accessor Field to Work with a Referenced Object.

  • Don't write complex data security predicates for the target object because that will impact the query execution time, causing performance degradation.

Fixed Choice List Fields

Including fixed choice list (FCL) fields in a payload can impact the web service response time because it requires additional queries to fire. When you work with FCL fields, follow these recommendations:

  • Limit the number of FCL fields included in a service payload to four fields.

  • Only include an FCL field in the service payload when absolutely necessary.

  • Don't create lookup values if they won't be used.

Formula Fields

A formula field gets evaluated whenever it's referenced. Therefore, include only necessary formula fields in the service payload. Follow these recommendations when you work with formula fields:

  • Limit the usage of formula fields in the payload.

  • Don't include any persistent fields in the formula field calculation logic, unless absolutely needed.

Nonindexed Fields

Only a limited number of columns are indexed in the database table for a custom object. Therefore, you should use this property only for the most frequently searched fields. After the field is created, you can't change this property.

Note that using nonindexed fields for filtering in a web service call can affect performance. When you work with nonindexed fields, follow these recommendations:

  • Index only the fields most commonly used as web service filters.

  • Avoid indexing fields that will be rarely or minimally used in filtering.