Dialogue Script controls support use of the Salesforce Object Query Language (SOQL) for the programmatic and dynamic binding of database records to interactive web application controls. Extensions to SOQL, referred to as
SOQL Plus, allow web developers to use SOQL in a context that is more aligned with traditional SQL or PL-SQL syntax.
EditExample Usage:
<dlog:repeater id="ObjectRepeater"
SOQL="SELECT TOP 10 * FROM Content__c WHERE Type__c='Press Release' ORDER BY CreatedDate DESC">
<ItemTemplate>
/* Display of iterated records */
</ItemTemplate>
</dlog:repeater>
EditSOQL Plus Extensions
Dialogue Script controls that support SOQL queries have access to a number of additional query features not available in SOQL.
TOP : Supports the selection of a finite number of records. Ideal for use in web pages that show top 10 articles or recent news items.
Example:
SELECT TOP 10 * From Solution
Wildcard Column Selection : Supports the selection of all available columns using an asterisk '*'.
Example:
SELECT * FROM Case WHERE Status='Open'
IN : Supports nested queries.
Example:
SELECT * FROM Contact WHERE AccountId IN (SELECT from Account WHERE Type='Customer')
Example 2:
SELECT * FROM CustomObject WHERE Id:CustomObjectId IN (SELECT from IntersectionObject WHERE Status=1)
(Note the ':' operator, which tells SOQL+ which fields to use for comparison, in this case Id on CustomObject and
CustomObjectId in IntsersectionObject)
ORDER BY (ASC | DESC) : Supports ascending and descending sorting of query results.
EditCaching
Dialogue Script controls that make use of SOQL Plus support caching of query results to improve application performance. Three attributes are available on Dialogue Script controls for managing the query result cache.
EnableCache (
true / false) : Determines whether the query results should be cached. If true, then subsequent rendering of the control will re-use the results from a previous query for up to CacheDurationMinutes.
CacheContainer (
application / session) : Determines whether query results are cached at application (global) scope or session (per user) scope. Queries that utilize Profile merge tags, such as {!Profile.Id}, must use the Session cache to ensure site visitors will not see other visitors information. Query results stored in the application cache are viewable by all site visitors.
CacheDurationMinutes (
0 - x) : Determines the time in minutes to retain query results.
<dlog:repeater id="ObjectRepeater"
SOQL="SELECT TOP 10 * FROM Content__c WHERE Type__c='Press Release' ORDER BY CreatedDate DESC"
EnableCache="true" CacheContainer="application" CacheDurationMinutes="60">
</dlog:repeater>
EditFunctions and Substitutions
SOQL+ provides several substitution and
merge tags, which are akin to variables, as well as helper functions. These are delimited in the body of the SOQL+ with curly braces { }. The following is a list of supported Substitution tags:
RT:class.recordtypename : Returns the SFID of a supplied RecordType name (for the supplied class). For example: {RT:Opportunity.ARecordType}
LookupReference : Used in conjunction with the DialogueScript repeater (and other databound controls). See appropriate control documentation for more information.