What is a Dataview?
A dataview defines an object or objects that can be interrogated by the Action Views function. The primary object is the main source object that the dataview focuses on. For example, a dataview for inquiring on opportunities typically has a primary object of Opportunity. Depending on the structure of your data, you may need to join other objects to the primary object so that the dataview can interrogate multiple source objects.
Some standard dataviews are supplied with Reporting for inquiring on custom objects. You can customize these dataviews or create your own from scratch.
Fields typically correspond to the object fields that you want to make available in the dataview. Fields can be used for selection purposes, presentation purposes, or both. For example, if one of the source objects is Opportunity, you might want to include its Type field for both selection and presentation purposes so that users can:
- Create a selection rule that says "retrieve opportunities where type is new customer".
- Add a column to display the type of each transaction retrieved by the action view.
Some fields cannot be used for selection purposes because of a Salesforce limitation which prevents some object fields (including Text Area fields) from being queried.
Fields for encrypted object fields can be used for selection and presentation purposes, but the results will be illegible so we recommend that you do not use them.
The BillingAddress field, which is available on several objects including Account, cannot be added to a dataview.
Transposing Data
Depending on the structure of your data, you may have situations where the kind of content held by a field varies. For example, an object stores records that contain different kinds of values including budget, forecast, and actual. If you create a dataview using this object as a source object, and you look at the Value field, when that field is used for selection or presentation purposes its values will be a mixture of budget, forecast, and actual values. To separate those values so that one field represents budget values, another represents forecast values, another represents actual values, and so on, you need to transpose the different kinds of content to different fields. So you could have a Value - Budget field, a Value - Forecast field, and a Value - Actuals field. In this example, you can then present the different kinds of values in separate columns in the action view results.
Sometimes you may need to transpose data across joined objects. If you want one column to hold two values, you can do this by transposing these two fields into one presentable column, rather than two.
Common Names
A common name is a label that identifies a field across dataviews. For example, you might create separate dataviews for different types of Opportunities. Each Opportunity has its own field representing Account number:
Object Name | Field Name | Suggested Common Name |
---|---|---|
Opportunity1 | Name | AccountNumber |
Opportunity2 | Name | AccountNumber |
Opportunity3 | Name | AccountNumber |
If you assign "AccountNumber", or something similar, as the common name to each of these fields in their own dataview, then you provide context that can be used when drilling around action view results.
Common names are held in a picklist on the Dataview Field custom object.
For more information about how to use common names, see the example in About Common Names and Drilling.
Reversible Fields
You can enable numeric fields to be displayed with reverse sign if the rule on the Action View Template - Reverse Sign tab requires it. You can set conditions which determine when the sign is reversed: when the conditions are met, positive values change to negative, or vice versa. Only numeric fields where the Reversible checkbox is enabled on the dataview are shown with reverse sign.
The Key Field
A key field must be set for users to be able to flag rows for attention when browsing action view results. Ideally, the key field should be a field that will uniquely identify each row in the results. For example, if the dataview's primary object is Opportunity your key field could be Account Number.
Currency Fields
In a dataview, if you want to use a currency field and are in a multi-currency org, then you can select to use either the record currency or the user currency. Your dataview allows you to use either just one or both of the currencies.
Record currency and user currency can both be used to create a transpose field. However, user currency is not supported for the resulting value selections.
Depending on the structure of your data and how users want to inquire on it, you might need to join other objects to the primary object:
- Lookup join: Join to an object related to the current object by a lookup.
- Relationship join: Join to an object related to the primary object by a master-detail relationship.
- Aggregate join: Join to an object to perform a summarization from one to many.
The joins between objects in a dataview are displayed on the Joins tab as a tree structure, with the primary object as the root node. For details of how to create joins, see Creating Dataviews. After creating or editing your dataview to use joins, you can add dataview fields to your action view templates. In action views, for an aggregated join you can, for example, select an invoice and sum the totals for all the invoice line items.
Join Filters
When creating a relationship join or an aggregate join, you can apply a filter so that a subset of data is retrieved from the child object. For example, if the child object is a custom object storing addresses and you only want to retrieve line 1 of each address, you could specify a filter on the join to say select where AddressLineNo=1
. This means that you avoid retrieving duplicate rows where only the value in the AddressLine field changes.
Actions are essentially shortcuts to functions that you might want to run from the Action Views results grid. For example, if you are using a dataview for inquiring on opportunities, you might want to change the due date of an opportunity from the action views rather than the opportunity itself.
When adding an action to the dataview you must pick the Apex class that will be invoked. You can select any Apex class on your Salesforce org that implements the Action Interface.
Using Custom Apex Classes
If custom Apex classes have been installed on your org and you intend to configure them as actions, note that:
- The Apex class name, including
<prefix>.
, must not be more than 60 characters. - The Apex class must implement the Action Interface.
- The Apex class must include error handling.
- The Apex class must return a status message to the user interface, for example, Success or Failed.
- The Apex class must inform the user interface if a refresh is required, so that the latest status information can be displayed.