Salesforce Platform Developer II

Terms in this set (91)

When using multiple forms use <apex:actionRegion> to submit portions of the form.

Declare Variables as Transient to Reduce View State: An instance variable declared as transient is not saved and is not transmitted as part of the view state. If a certain field is needed only for the duration of the page request and does not need to be part of the view state, declare it as transient. See an example below. Some Apex objects are automatically considered transient

Recreate State versus Storing It in View State: View state should ideally contain only work in progress data (the current object being edited, multi-page wizard data, etc.) If you can reconstruct the data during postback, via a SOQL query or a web services call, do that instead of storing it in controller data members.

Use Custom Objects or Custom Settings to Store Large Quantities of Read-Only Data: Assume that your controller needs to call a Web service and parse a large response object. Storing it in view state may not even be an option given the size. Marking it as transient would incur the cost of an additional Web service call and parsing it again. In such instances, you could store the parsed response in a custom object and store just the record id to get to the parsed response. Custom settings provide another mechanism to cache data needed by your controller. Accessing custom settings is faster than access to custom objects since custom settings are part of your application's cache and does not require a database query to retrieve the data. Please consult the online documentation for additional details on Custom Setting.

Refine Your SOQL to Retrieve Only the Data Needed by the Page: Only retrieve (and store) the fields you need and also filter the data to only retrieve data needed by the page.

Refactor Your Pages to Make Its View Stateless: Instead of using apex:commandLink or apex:commandButton components (which need to be inside a apex:form component) to invoke an action, use an apex:outputLink or other non-action method instead and implement the action through an apex:page action attribute - where it makes sense. The following code shows two ways to invoke a controller method called proccessData() - first with a commandLink, and then with an outputLink and auxiliary page.
Compound fields are read-only. To update field values, modify the individual field components.

Compound fields are accessible only through the SOAP and REST APIs. The compound versions of fields aren't accessible anywhere in the Salesforce user interface.

Although compound fields can be queried with the Location and Address Apex classes, they're editable only as components of the actual field. Read and set geolocation field components by appending "__latitude__s" or "__longitude__s" to the field name, instead of the usual "__c." For example:

Double theLatitude = myObject__c.aLocation__latitude__s;
myObject__c.aLocation__longitude__s = theLongitude;

You can't access or set the compound value

You can't use compound fields in Visualforce—for example, in an <apex:outputField>. To access or update field values, use the individual field components.

If you select compound fields for export in the Data Loader, they cause error messages. To export values, use individual field components.

Geolocation fields and latitude and longitude on standard addresses aren't supported in the Data Import Wizard. Use the SOAP or REST APIs to import these fields. If you don't have a preferred tool for working with Salesforce APIs, Workbench is an easy way to get started.

Custom geolocation and location fields on standard addresses aren't supported with email templates.

You can't use compound fields in lookup filters, except to filter distances that are within or not within given ranges. You can use distance lookup filters only in the Metadata API.

The only formula functions that you can use with compound fields are ISBLANK, ISCHANGED, and ISNULL. You can't use BLANKVALUE, CASE, NULLVALUE, PRIORVALUE, or the equality and comparison operators with compound fields. The equality and comparison operators include = and == (equal), <> and != (not equal), < (less than), > (greater than), <= (less than or equal), >= (greater than or equal), && (AND), and || (OR).

https://developer.salesforce.com/docs/atlas.en-us.api.meta/api/compound_fields_limitations.htm
;