<html>
<head>
    <base href="https://docs.jboss.org/author">
            <link rel="stylesheet" href="/author/s/en/2172/19/5/_/styles/combined.css?spaceKey=TEIID&amp;forWysiwyg=true" type="text/css">
    </head>
<body style="background: white;" bgcolor="white" class="email-body">
<div id="pageContent">
<div id="notificationFormat">
<div class="wiki-content">
<div class="email">
    <h2><a href="https://docs.jboss.org/author/display/TEIID/Salesforce+Translator">Salesforce Translator</a></h2>
    <h4>Page <b>edited</b> by             <a href="https://docs.jboss.org/author/display/~shawkins">Steven Hawkins</a>
    </h4>
        <br/>
                         <h4>Changes (12)</h4>
                                 
    
<div id="page-diffs">
                    <table class="diff" cellpadding="0" cellspacing="0">
    
            <tr><td class="diff-snipped" >...<br></td></tr>
            <tr><td class="diff-unchanged" >h3. {color:#000000}{*}Selecting from Multi-Select Picklists{*}{color} <br> <br></td></tr>
            <tr><td class="diff-changed-lines" >{color:#333333}A multi-select picklist is a field type in Salesforce that can contain multiple values in a single field. Query criteria operators for fields of this type in SOQL are limited to EQ, NE, includes and excludes. The full Salesforce documentation for selecting from mullti-select picklists can be found at the following <span class="diff-deleted-words"style="color:#999;background-color:#fdd;text-decoration:line-through;">link.&amp;nbsp;{color}{color:#005e8f}[{color:#005e8f}Querying</span> <span class="diff-added-words"style="background-color: #dfd;">link.&amp;nbsp;{color}[Querying</span> Mulit-select <span class="diff-deleted-words"style="color:#999;background-color:#fdd;text-decoration:line-through;">Picklists{color}|http://www.salesforce.com/us/developer/docs/api/index_Left.htm#StartTopic=Content%2Fsforce_api_calls_soql_querying_multiselect_picklists.htm|SkinName=webhelp]{color}</span> <span class="diff-added-words"style="background-color: #dfd;">Picklists|http://www.salesforce.com/us/developer/docs/api/index_Left.htm#StartTopic=Content%2Fsforce_api_calls_soql_querying_multiselect_picklists.htm\|SkinName=webhelp]</span> <br></td></tr>
            <tr><td class="diff-unchanged" > <br></td></tr>
            <tr><td class="diff-changed-lines" ><span class="diff-changed-words"><span class="diff-deleted-chars"style="color:#999;background-color:#fdd;text-decoration:line-through;">{color:#333333}</span>Teiid</span> SQL does not support the includes or excludes operators, but the Salesforce connector provides user defined function definitions for these operators that provided equivalent functionality for fields of type multi-select. The definition for the functions <span class="diff-changed-words">is:<span class="diff-deleted-chars"style="color:#999;background-color:#fdd;text-decoration:line-through;">{color}</span></span> <br></td></tr>
            <tr><td class="diff-unchanged" >{code} <br>boolean includes(Column column, String param) <br></td></tr>
            <tr><td class="diff-snipped" >...<br></td></tr>
            <tr><td class="diff-unchanged" >        ID string <br>{code} <br></td></tr>
            <tr><td class="diff-deleted-lines" style="color:#999;background-color:#fdd;text-decoration:line-through;">{color:#333333}See the description of the&amp;nbsp;{color}{color:#005e8f}[{color:#005e8f}GetUpdated{color}|http://www.salesforce.com/us/developer/docs/api/Content/sforce_api_calls_getupdated.htm]{color}{color:#333333}&amp;nbsp;operation in the Salesforce documentation for usage details.{color} <br></td></tr>
            <tr><td class="diff-added-lines" style="background-color: #dfd;">{color:#333333}See the description of the&amp;nbsp;{color}[GetUpdated|http://www.salesforce.com/us/developer/docs/api/Content/sforce_api_calls_getupdated.htm]&amp;nbsp;operation in the Salesforce documentation for usage details. <br></td></tr>
            <tr><td class="diff-unchanged" > <br>h3. {color:#000000}{*}Selecting Deleted Objects{*}{color} <br></td></tr>
            <tr><td class="diff-snipped" >...<br></td></tr>
            <tr><td class="diff-unchanged" >        DeletedDate datetime <br>{code} <br></td></tr>
            <tr><td class="diff-deleted-lines" style="color:#999;background-color:#fdd;text-decoration:line-through;">{color:#333333}See the description of the&amp;nbsp;{color}{color:#005e8f}[{color:#005e8f}GetDeleted{color}|http://www.salesforce.com/us/developer/docs/api/Content/sforce_api_calls_getdeleted.htm]{color}{color:#333333}&amp;nbsp;operation in the Salesforce documentation for usage details.{color} <br></td></tr>
            <tr><td class="diff-added-lines" style="background-color: #dfd;">{color:#333333}See the description of the&amp;nbsp;{color}[GetDeleted|http://www.salesforce.com/us/developer/docs/api/Content/sforce_api_calls_getdeleted.htm]&amp;nbsp;operation in the Salesforce documentation for usage details. <br></td></tr>
            <tr><td class="diff-unchanged" > <br>h3. {color:#000000}{*}Relationship Queries{*}{color} <br></td></tr>
            <tr><td class="diff-snipped" >...<br></td></tr>
            <tr><td class="diff-unchanged" >{code:lang=SQL}SELECT Account.Name, (SELECT Contact.Name FROM <br>Account.Contacts) FROM Account{code} <br></td></tr>
            <tr><td class="diff-deleted-lines" style="color:#999;background-color:#fdd;text-decoration:line-through;">{color:#333333}See the description of the&amp;nbsp;{color}{color:#005e8f}[{color:#005e8f}Relationship Queries{color}|http://www.salesforce.com/us/developer/docs/api/index_Left.htm#StartTopic=Content/sforce_api_calls_soql_relationships.htm]{color}{color:#333333}&amp;nbsp;operation in the SalesForce documentation for limitations.{color} <br></td></tr>
            <tr><td class="diff-added-lines" style="background-color: #dfd;">{color:#333333}See the description of the&amp;nbsp;{color}[Relationship Queries|http://www.salesforce.com/us/developer/docs/api/index_Left.htm#StartTopic=Content/sforce_api_calls_soql_relationships.htm]&amp;nbsp;operation in the SalesForce documentation for limitations. <br></td></tr>
            <tr><td class="diff-unchanged" > <br>h3. {color:#000000}{*}Supported Capabilities{*}{color} <br></td></tr>
            <tr><td class="diff-snipped" >...<br></td></tr>
            <tr><td class="diff-unchanged" >h3. {color:#000000}{*}Native Queries{*}{color} <br> <br></td></tr>
            <tr><td class="diff-changed-lines" >{color:#333333}Salesforce procedures may optionally have native queries associated with them - <span class="diff-deleted-words"style="color:#999;background-color:#fdd;text-decoration:line-through;">see&amp;nbsp;{color}{color:#005e8f}[{color:#005e8f}Parameterizable</span> <span class="diff-added-words"style="background-color: #dfd;">see&amp;nbsp;{color}[Parameterizable</span> Native <span class="diff-deleted-words"style="color:#999;background-color:#fdd;text-decoration:line-through;">Queries{color}|#native]{color}{color:#333333}.</span> <span class="diff-added-words"style="background-color: #dfd;">Queries|Built-in Translators#native].</span> The operation prefix (select;, insert;, update;, delete; - see the native procedure logic below for more) must be present in the native-query, but it will not be issued as part of the query to the <span class="diff-changed-words">source.<span class="diff-deleted-chars"style="color:#999;background-color:#fdd;text-decoration:line-through;">{color}</span></span> <br></td></tr>
            <tr><td class="diff-unchanged" >{code:sql|title=Example DDL for a SF native procedure} <br>CREATE FOREIGN PROCEDURE proc (arg1 integer, arg2 string) OPTIONS (&quot;teiid_rel:native-query&quot; &#39;search;SELECT ... complex SOQL ... WHERE col1 = $1 and col2 = $2&#39;) returns (col1 string, col2 string, col3 timestamp); <br></td></tr>
            <tr><td class="diff-snipped" >...<br></td></tr>
            <tr><td class="diff-unchanged" >h4. {color:#000000}{*}Native Procedure{*}{color} <br>{warning} <br></td></tr>
            <tr><td class="diff-changed-lines" >{color:#333333}This feature is turned off by default because of the security risk this exposes to execute any command against the source. To enable this feature, override the translator property called &quot;SupportsNativeQueries&quot; to true. Look <span class="diff-deleted-words"style="color:#999;background-color:#fdd;text-decoration:line-through;">for&amp;nbsp;{color}{color:#005e8f}[{color:#005e8f}Override</span> <span class="diff-added-words"style="background-color: #dfd;">for&amp;nbsp;{color}[Override</span> Execution <span class="diff-deleted-words"style="color:#999;background-color:#fdd;text-decoration:line-through;">Properties{color}|#Override</span> <span class="diff-added-words"style="background-color: #dfd;">Properties|Built-in Translators#Override</span> Execution <span class="diff-deleted-words"style="color:#999;background-color:#fdd;text-decoration:line-through;">Properties]{color}{color:#333333}&amp;nbsp;above.{color}{warning}</span> <span class="diff-added-words"style="background-color: #dfd;">Properties]&amp;nbsp;above.{warning}</span> <br></td></tr>
            <tr><td class="diff-changed-lines" >{color:#333333}SalesForce translator provides a procedure with name&amp;nbsp;{color}{color:#333333}{*}native{*}{color}{color:#333333}&amp;nbsp;that gives ability to execute any ad-hoc native Salesforce queries directly against the source without any Teiid parsing or resolving. The metadata of this procedure&#39;s execution results are not known to the Teiid, and they are returned as object array. User can <span class="diff-deleted-words"style="color:#999;background-color:#fdd;text-decoration:line-through;">use&amp;nbsp;{color}{color:#005e8f}[{color:#005e8f}ARRAYTABLE{color}|ARRAYTABLE]{color}{color:#333333}&amp;nbsp;construct</span> <span class="diff-added-words"style="background-color: #dfd;">use&amp;nbsp;{color}[ARRAYTABLE]&amp;nbsp;construct</span> to build a tabular output for consumption by client applications. Teiid exposes this procedure with a simple query structure as <span class="diff-changed-words">below<span class="diff-deleted-chars"style="color:#999;background-color:#fdd;text-decoration:line-through;">{color}</span></span> <br></td></tr>
            <tr><td class="diff-unchanged" > <br>h5. {color:#000000}{*}Select{*}{color} <br></td></tr>
            <tr><td class="diff-snipped" >...<br></td></tr>
            <tr><td class="diff-unchanged" >{code} <br>{color:#333333}from the above code, the &quot;{color}{color:#333333}{*}search{*}{color}{color:#333333}&quot; keyword followed by a query statement.{color}{note} <br></td></tr>
            <tr><td class="diff-changed-lines" >{color:#333333}The SOQL is treated as a parameterized native query so that parameter values may be inserted in the query string properly - <span class="diff-deleted-words"style="color:#999;background-color:#fdd;text-decoration:line-through;">see&amp;nbsp;{color}{color:#005e8f}[{color:#005e8f}Parameterizable</span> <span class="diff-added-words"style="background-color: #dfd;">see&amp;nbsp;{color}[Parameterizable</span> Native <span class="diff-deleted-words"style="color:#999;background-color:#fdd;text-decoration:line-through;">Queries{color}|#native]{color}{note}</span> <span class="diff-added-words"style="background-color: #dfd;">Queries|Built-in Translators#native]{note}</span> <br></td></tr>
            <tr><td class="diff-unchanged" > <br>h5. {color:#000000}{*}Delete{*}{color} <br></td></tr>
            <tr><td class="diff-snipped" >...<br></td></tr>
    
            </table>
    </div>                            <h4>Full Content</h4>
                    <div class="notificationGreySide">
        <h1><a name="SalesforceTranslator-"></a><font color="#000000"><b>Salesforce Translator</b></font></h1>

<p><font color="#333333">The Salesforce translator, known by the type name&nbsp;</font><font color="#333333"><em>salesforce</em></font><font color="#333333">&nbsp;supports the SELECT, DELETE, INSERT and UPDATE operations against a Salesforce.com account. It is designed for use with the Teiid Salesforce resource adapter.</font></p>
<div class='table-wrap'>
<table class='confluenceTable'><tbody>
<tr>
<th class='confluenceTh'> <font color="#000000">Name</font> </th>
<th class='confluenceTh'> <font color="#000000">Description</font> </th>
<th class='confluenceTh'> <font color="#000000">Default</font> </th>
</tr>
<tr>
<td class='confluenceTd'> <font color="#333333">ModelAuditFeilds</font> </td>
<td class='confluenceTd'> <font color="#333333">Audit Model Fields</font> </td>
<td class='confluenceTd'> <font color="#333333">false</font> </td>
</tr>
</tbody></table>
</div>

<p><font color="#333333"><b>Execution Properties</b></font><font color="#333333">&nbsp;</font></p>

<p><font color="#333333">The Salesforce translator can import metadata, but does not currently have import settings.</font></p>

<h3><a name="SalesforceTranslator-"></a><font color="#000000"><b>SQL Processing</b></font></h3>

<p><font color="#333333">Salesforce does not provide the same set of functionality as a relational database. For example, Salesforce does not support arbitrary joins between tables. However, working in combination with the Teiid Query Planner, the Salesforce connector supports nearly all of the SQL syntax supported by the Teiid.</font></p>

<p><font color="#333333">The Salesforce Connector executes SQL commands by “pushing down” the command to Salesforce whenever possible, based on the supported capabilities. Teiid will automatically provide additional database functionality when the Salesforce Connector does not        explicitly provide support for a given SQL construct. In these cases, the SQL construct cannot be “pushed down” to the data source, so it will be evaluated in Teiid, in order to ensure that the operation is performed.</font></p>

<p><font color="#333333">In cases where certain SQL capabilities cannot be pushed down to Salesforce, Teiid will push down the capabilities that are supported, and fetch a set of data from Salesforce. Then, Teiid will evaluate the additional capabilities, creating a subset of the original data set. Finally, Teiid will pass the result to the client.</font></p>
<div class="code panel" style="border-width: 1px;"><div class="codeContent panelContent">
<pre class="theme: Confluence; brush: sql; gutter: false" style="font-size:12px; font-family: ConfluenceInstalledFont,monospace;">
SELECT sum(Reports) FROM Supervisor where Division = 'customer support';
</pre>
</div></div>
<p><font color="#333333">Neither Salesforce nor the Salesforce Connector support the sum() scalar function, but they do support CompareCriteriaEquals, so the query that is passed to Salesforce by the connector will be transformed to this query.</font></p>
<div class="code panel" style="border-width: 1px;"><div class="codeContent panelContent">
<pre class="theme: Confluence; brush: sql; gutter: false" style="font-size:12px; font-family: ConfluenceInstalledFont,monospace;">
SELECT Reports FROM Supervisor where Division = 'customer support';
</pre>
</div></div>
<p><font color="#333333">The sum() scalar function will be applied by the Teiid Query Engine to the result set returned by the connector.</font></p>

<p><font color="#333333">In some cases multiple calls to the Salesforce application will be made to support the SQL passed to the connector.</font></p>
<div class="code panel" style="border-width: 1px;"><div class="codeContent panelContent">
<pre class="theme: Confluence; brush: sql; gutter: false" style="font-size:12px; font-family: ConfluenceInstalledFont,monospace;">DELETE From Case WHERE Status = 'Closed';</pre>
</div></div>
<p><font color="#333333">The API in Salesforce to delete objects only supports deleting by ID. In order to accomplish this the Salesforce connector will first execute a query to get the IDs of the correct objects, and then delete those objects. So the above DELETE command will result in the following two commands.</font></p>
<div class="code panel" style="border-width: 1px;"><div class="codeContent panelContent">
<pre class="theme: Confluence; brush: sql; gutter: false" style="font-size:12px; font-family: ConfluenceInstalledFont,monospace;">
SELECT ID From Case WHERE Status = 'Closed';
DELETE From Case where ID IN (&lt;result of query&gt;);
</pre>
</div></div>
<p><font color="#333333">&#42;The Salesforce API DELETE call is not expressed in SQL, but the above is an SQL equivalent expression.</font></p>

<p><font color="#333333">It's useful to be aware of unsupported capabilities, in order to avoid fetching large data sets from Salesforce and making you queries as performant as possible. See all Supported Capabilities.</font></p>

<h3><a name="SalesforceTranslator-"></a><font color="#000000"><b>Selecting from Multi-Select Picklists</b></font></h3>

<p><font color="#333333">A multi-select picklist is a field type in Salesforce that can contain multiple values in a single field. Query criteria operators for fields of this type in SOQL are limited to EQ, NE, includes and excludes. The full Salesforce documentation for selecting from mullti-select picklists can be found at the following link.&nbsp;</font><a href="http://www.salesforce.com/us/developer/docs/api/index_Left.htm#StartTopic=Content%2Fsforce_api_calls_soql_querying_multiselect_picklists.htm" title="SkinName=webhelp" class="external-link" rel="nofollow">Querying Mulit-select Picklists</a></p>

<p>Teiid SQL does not support the includes or excludes operators, but the Salesforce connector provides user defined function definitions for these operators that provided equivalent functionality for fields of type multi-select. The definition for the functions is:</p>
<div class="code panel" style="border-width: 1px;"><div class="codeContent panelContent">
<pre class="theme: Confluence; brush: java; gutter: false" style="font-size:12px; font-family: ConfluenceInstalledFont,monospace;">
boolean includes(Column column, String param)
boolean excludes(Column column, String param)
</pre>
</div></div>
<p><font color="#333333">For example, take a single multi-select picklist column called Status that contains all of these values.</font></p>
<ul>
        <li>current</li>
</ul>


<ul>
        <li>working</li>
</ul>


<ul>
        <li>critical</li>
</ul>


<p><font color="#333333">For that column, all of the below are valid queries:</font></p>
<div class="code panel" style="border-width: 1px;"><div class="codeContent panelContent">
<pre class="theme: Confluence; brush: sql; gutter: false" style="font-size:12px; font-family: ConfluenceInstalledFont,monospace;">
SELECT * FROM Issue WHERE true = includes (Status, 'current, working' );
SELECT * FROM Issue WHERE true = excludes (Status, 'current, working' );
SELECT * FROM Issue WHERE true = includes (Status, 'current;working, critical' );
</pre>
</div></div>
<p><font color="#333333">EQ and NE criteria will pass to Salesforce as supplied. For example, these queries will not be modified by the connector.</font></p>
<div class="code panel" style="border-width: 1px;"><div class="codeContent panelContent">
<pre class="theme: Confluence; brush: sql; gutter: false" style="font-size:12px; font-family: ConfluenceInstalledFont,monospace;">
SELECT * FROM Issue WHERE Status = 'current';
SELECT * FROM Issue WHERE Status = 'current;critical';
SELECT * FROM Issue WHERE Status != 'current;working';
</pre>
</div></div>

<h3><a name="SalesforceTranslator-"></a><font color="#000000"><b>Selecting All Objects</b></font></h3>

<p><font color="#333333">The Salesforce connector supports the calling the queryAll operation from the Salesforce API. The queryAll operation is equivalent to the query operation with the exception that it returns data about&nbsp;</font><font color="#333333"><b>all current and deleted</b></font><font color="#333333">objects in the system.</font></p>

<p><font color="#333333">The connector determines if it will call the query or queryAll operation via reference to the isDeleted property present on each Salesforce object, and modeled as a column on each table generated by the importer. By default this value is set to False when the model is generated and thus the connector calls query. Users are free to change the value in the model to True, changing the default behavior of the connector to be queryAll.</font></p>

<p><font color="#333333">The behavior is different if isDeleted is used as a parameter in the query. If the isDeleted column is used as a parameter in the query, and the value is 'true' the connector will call queryAll.</font></p>
<div class="code panel" style="border-width: 1px;"><div class="codeContent panelContent">
<pre class="theme: Confluence; brush: sql; gutter: false" style="font-size:12px; font-family: ConfluenceInstalledFont,monospace;">
select * from Contact where isDeleted = true;
</pre>
</div></div>
<p><font color="#333333">If the isDeleted column is used as a parameter in the query, and the value is 'false' the connector perform the default behavior will call query.</font></p>
<div class="code panel" style="border-width: 1px;"><div class="codeContent panelContent">
<pre class="theme: Confluence; brush: sql; gutter: false" style="font-size:12px; font-family: ConfluenceInstalledFont,monospace;">
select * from Contact where isDeleted = false;
</pre>
</div></div>

<h3><a name="SalesforceTranslator-"></a><font color="#000000"><b>Selecting Updated Objects</b></font></h3>

<p><font color="#333333">If the option is selected when importing metadata from Salesforce, a GetUpdated procedure is generated in the model with the following structure:</font></p>
<div class="code panel" style="border-width: 1px;"><div class="codeContent panelContent">
<pre class="theme: Confluence; brush: sql; gutter: false" style="font-size:12px; font-family: ConfluenceInstalledFont,monospace;">GetUpdated (ObjectName IN string,
        StartDate IN datetime,
        EndDate IN datetime,
        LatestDateCovered OUT datetime)
returns
        ID string
</pre>
</div></div>
<p><font color="#333333">See the description of the&nbsp;</font><a href="http://www.salesforce.com/us/developer/docs/api/Content/sforce_api_calls_getupdated.htm" class="external-link" rel="nofollow">GetUpdated</a>&nbsp;operation in the Salesforce documentation for usage details.</p>

<h3><a name="SalesforceTranslator-"></a><font color="#000000"><b>Selecting Deleted Objects</b></font></h3>

<p><font color="#333333">If the option is selected when importing metadata from Salesforce, a GetDeleted procedure is generated in the model with the following structure:</font></p>
<div class="code panel" style="border-width: 1px;"><div class="codeContent panelContent">
<pre class="theme: Confluence; brush: sql; gutter: false" style="font-size:12px; font-family: ConfluenceInstalledFont,monospace;">GetDeleted (ObjectName IN string,
        StartDate IN datetime,
        EndDate IN datetime,
        EarliestDateAvailable OUT datetime,
        LatestDateCovered OUT datetime)
returns
        ID string,
        DeletedDate datetime
</pre>
</div></div>
<p><font color="#333333">See the description of the&nbsp;</font><a href="http://www.salesforce.com/us/developer/docs/api/Content/sforce_api_calls_getdeleted.htm" class="external-link" rel="nofollow">GetDeleted</a>&nbsp;operation in the Salesforce documentation for usage details.</p>

<h3><a name="SalesforceTranslator-"></a><font color="#000000"><b>Relationship Queries</b></font></h3>

<p><font color="#333333">Salesforce does not support joins like a relational database, but it does have support for queries that include parent-to-child or child-to-parent relationships between objects. These are termed Relationship Queries. The SalesForce connector supports Relationship Queries through Outer Join syntax.</font></p>
<div class="code panel" style="border-width: 1px;"><div class="codeContent panelContent">
<pre class="theme: Confluence; brush: sql; gutter: false" style="font-size:12px; font-family: ConfluenceInstalledFont,monospace;">SELECT Account.name, Contact.Name from Contact LEFT OUTER JOIN Account
on Contact.Accountid = Account.id</pre>
</div></div>
<p><font color="#333333">This query shows the correct syntax to query a SalesForce model with to produce a relationship query from child to parent. It resolves to the following query to SalesForce.</font></p>
<div class="code panel" style="border-width: 1px;"><div class="codeContent panelContent">
<pre class="theme: Confluence; brush: sql; gutter: false" style="font-size:12px; font-family: ConfluenceInstalledFont,monospace;">SELECT Contact.Account.Name, Contact.Name FROM Contact</pre>
</div></div>
<p><font color="#333333">&nbsp;</font></p>
<div class="code panel" style="border-width: 1px;"><div class="codeContent panelContent">
<pre class="theme: Confluence; brush: sql; gutter: false" style="font-size:12px; font-family: ConfluenceInstalledFont,monospace;">select Contact.Name, Account.Name from Account Left outer Join Contact
on Contact.Accountid = Account.id</pre>
</div></div>
<p><font color="#333333">This query shows the correct syntax to query a SalesForce model with to produce a relationship query from parent to child. It resolves to the following query to SalesForce.</font></p>
<div class="code panel" style="border-width: 1px;"><div class="codeContent panelContent">
<pre class="theme: Confluence; brush: sql; gutter: false" style="font-size:12px; font-family: ConfluenceInstalledFont,monospace;">SELECT Account.Name, (SELECT Contact.Name FROM
Account.Contacts) FROM Account</pre>
</div></div>
<p><font color="#333333">See the description of the&nbsp;</font><a href="http://www.salesforce.com/us/developer/docs/api/index_Left.htm#StartTopic=Content/sforce_api_calls_soql_relationships.htm" class="external-link" rel="nofollow">Relationship Queries</a>&nbsp;operation in the SalesForce documentation for limitations.</p>

<h3><a name="SalesforceTranslator-"></a><font color="#000000"><b>Supported Capabilities</b></font></h3>

<p><font color="#333333">The following are the the connector capabilities supported by the Salesforce Connector. These SQL constructs will be pushed down to Salesforce.</font></p>
<ul>
        <li>SELECT command</li>
</ul>


<ul>
        <li>INSERT Command</li>
</ul>


<ul>
        <li>UPDATE Command</li>
</ul>


<ul>
        <li>DELETE Command</li>
</ul>


<ul>
        <li>CompareCriteriaEquals</li>
</ul>


<ul>
        <li>InCriteria</li>
</ul>


<ul>
        <li>LikeCriteria - Supported for String fields only.</li>
</ul>


<ul>
        <li>RowLimit</li>
</ul>


<ul>
        <li>AggregatesCountStar</li>
</ul>


<ul>
        <li>NotCriteria</li>
</ul>


<ul>
        <li>OrCriteria</li>
</ul>


<ul>
        <li>CompareCriteriaOrdered</li>
</ul>


<ul>
        <li>OuterJoins with join criteria KEY</li>
</ul>


<h3><a name="SalesforceTranslator-"></a><font color="#000000"><b>Native Queries</b></font></h3>

<p><font color="#333333">Salesforce procedures may optionally have native queries associated with them - see&nbsp;</font><a href="/author/display/TEIID/Built-in+Translators#Built-inTranslators-native">Parameterizable Native Queries</a>. The operation prefix (select;, insert;, update;, delete; - see the native procedure logic below for more) must be present in the native-query, but it will not be issued as part of the query to the source.</p>
<div class="code panel" style="border-width: 1px;"><div class="codeHeader panelHeader" style="border-bottom-width: 1px;"><b>Example DDL for a SF native procedure</b></div><div class="codeContent panelContent">
<pre class="theme: Confluence; brush: sql; gutter: false" style="font-size:12px; font-family: ConfluenceInstalledFont,monospace;">
CREATE FOREIGN PROCEDURE proc (arg1 integer, arg2 string) OPTIONS ("teiid_rel:native-query" 'search;SELECT ... complex SOQL ... WHERE col1 = $1 and col2 = $2') returns (col1 string, col2 string, col3 timestamp);
</pre>
</div></div>

<h4><a name="SalesforceTranslator-"></a><font color="#000000"><b>Native Procedure</b></font></h4>
<div class='panelMacro'><table class='warningMacro'><colgroup><col width='24'><col></colgroup><tr><td valign='top'><img src="/author/images/icons/emoticons/forbidden.gif" width="16" height="16" align="absmiddle" alt="" border="0"></td><td><font color="#333333">This feature is turned off by default because of the security risk this exposes to execute any command against the source. To enable this feature, override the translator property called "SupportsNativeQueries" to true. Look for&nbsp;</font><a href="/author/display/TEIID/Built-in+Translators#Built-inTranslators-OverrideExecutionProperties">Override Execution Properties</a>&nbsp;above.</td></tr></table></div>
<p><font color="#333333">SalesForce translator provides a procedure with name&nbsp;</font><font color="#333333"><b>native</b></font><font color="#333333">&nbsp;that gives ability to execute any ad-hoc native Salesforce queries directly against the source without any Teiid parsing or resolving. The metadata of this procedure's execution results are not known to the Teiid, and they are returned as object array. User can use&nbsp;</font><a href="/author/display/TEIID/ARRAYTABLE" title="ARRAYTABLE">ARRAYTABLE</a>&nbsp;construct to build a tabular output for consumption by client applications. Teiid exposes this procedure with a simple query structure as below</p>

<h5><a name="SalesforceTranslator-"></a><font color="#000000"><b>Select</b></font></h5>
<div class="code panel" style="border-width: 1px;"><div class="codeHeader panelHeader" style="border-bottom-width: 1px;"><b>Select Example</b></div><div class="codeContent panelContent">
<pre class="theme: Confluence; brush: sql; gutter: false" style="font-size:12px; font-family: ConfluenceInstalledFont,monospace;">
SELECT x.* FROM (call pm1.native('search;SELECT Account.Id, Account.Type, Account.Name FROM Account')) w,
 ARRAYTABLE(w.tuple COLUMNS "id" string , "type" string, "name" String) AS x
</pre>
</div></div>
<p><font color="#333333">from the above code, the "</font><font color="#333333"><b>search</b></font><font color="#333333">" keyword followed by a query statement.</font></p>
<div class='panelMacro'><table class='noteMacro'><colgroup><col width='24'><col></colgroup><tr><td valign='top'><img src="/author/images/icons/emoticons/warning.gif" width="16" height="16" align="absmiddle" alt="" border="0"></td><td><font color="#333333">The SOQL is treated as a parameterized native query so that parameter values may be inserted in the query string properly - see&nbsp;</font><a href="/author/display/TEIID/Built-in+Translators#Built-inTranslators-native">Parameterizable Native Queries</a></td></tr></table></div>

<h5><a name="SalesforceTranslator-"></a><font color="#000000"><b>Delete</b></font></h5>
<div class="code panel" style="border-width: 1px;"><div class="codeHeader panelHeader" style="border-bottom-width: 1px;"><b>Delete Example</b></div><div class="codeContent panelContent">
<pre class="theme: Confluence; brush: sql; gutter: false" style="font-size:12px; font-family: ConfluenceInstalledFont,monospace;">
SELECT x.* FROM (call pm1.native('delete;', 'id1', 'id2')) w,
 ARRAYTABLE(w.tuple COLUMNS "updatecount" integer) AS x
</pre>
</div></div>
<p><font color="#333333">form the above code, the "</font><font color="#333333"><b>delete</b></font><font color="#333333">;" keyword followed by the ids to delete as varargs.</font></p>

<h5><a name="SalesforceTranslator-"></a><font color="#000000"><b>Create or Update</b></font></h5>
<div class="code panel" style="border-width: 1px;"><div class="codeHeader panelHeader" style="border-bottom-width: 1px;"><b>Create Example</b></div><div class="codeContent panelContent">
<pre class="theme: Confluence; brush: sql; gutter: false" style="font-size:12px; font-family: ConfluenceInstalledFont,monospace;">
SELECT x.* FROM
 (call pm1.native('create;type=table;attributes=one,two,three', 'one', 2, 3.0)) w,
 ARRAYTABLE(w.tuple COLUMNS "update_count" integer) AS x
</pre>
</div></div>
<p><font color="#333333">form the above code, the "</font><font color="#333333"><b>create</b></font><font color="#333333">" or "</font><font color="#333333"><b>update</b></font><font color="#333333">" keyword must be followed by the following properties.&nbsp; Attributes must be matched positionally by the procedure variables - thus in the example attribute two will be set to 2.</font></p>
<div class='table-wrap'>
<table class='confluenceTable'><tbody>
<tr>
<th class='confluenceTh'> <font color="#000000">Property Name</font> </th>
<th class='confluenceTh'> <font color="#000000">Description</font> </th>
<th class='confluenceTh'> <font color="#000000">Required</font> </th>
</tr>
<tr>
<td class='confluenceTd'> <font color="#333333">type</font> </td>
<td class='confluenceTd'> <font color="#333333">Table Name</font> </td>
<td class='confluenceTd'> <font color="#333333">Yes</font> </td>
</tr>
<tr>
<td class='confluenceTd'> <font color="#333333">attributes</font> </td>
<td class='confluenceTd'> <font color="#333333">comma separated list of names of the columns</font> </td>
</tr>
</tbody></table>
</div>

<p><font color="#333333">The values for each attribute is specified as separate argument to the "native" procedure.</font></p>

<p><font color="#333333">Update is similar to create, with one more extra property called "id", which defines identifier for the record.</font></p>
<div class="code panel" style="border-width: 1px;"><div class="codeHeader panelHeader" style="border-bottom-width: 1px;"><b>Update Example</b></div><div class="codeContent panelContent">
<pre class="theme: Confluence; brush: sql; gutter: false" style="font-size:12px; font-family: ConfluenceInstalledFont,monospace;">
SELECT x.* FROM
 (call pm1.native('update;id=pk;type=table;attributes=one,two,three', 'one', 2, 3.0)) w,
 ARRAYTABLE(w.tuple COLUMNS "update_count" integer) AS x
</pre>
</div></div>
<div class='panelMacro'><table class='infoMacro'><colgroup><col width='24'><col></colgroup><tr><td valign='top'><img src="/author/images/icons/emoticons/information.gif" width="16" height="16" align="absmiddle" alt="" border="0"></td><td><font color="#333333">By default the name of the procedure that executes the queries directly is called&nbsp;</font><font color="#333333"><b>native</b></font><font color="#333333">, however user can</font><br/>
<font color="#333333">set override execution property vdb.xml file to change it.</font></td></tr></table></div>

<h3><a name="SalesforceTranslator-"></a><font color="#000000"><b>JCA Resource Adapter</b></font></h3>

<p><font color="#333333">The resource adapter for this translator provided through "Salesforce Data Source", Refer to Admin Guide for configuration.</font></p>
    </div>
        <div id="commentsSection" class="wiki-content pageSection">
        <div style="float: right;" class="grey">
                        <a href="https://docs.jboss.org/author/users/removespacenotification.action?spaceKey=TEIID">Stop watching space</a>
            <span style="padding: 0px 5px;">|</span>
                <a href="https://docs.jboss.org/author/users/editmyemailsettings.action">Change email notification preferences</a>
</div>
        <a href="https://docs.jboss.org/author/display/TEIID/Salesforce+Translator">View Online</a>
        |
        <a href="https://docs.jboss.org/author/pages/diffpagesbyversion.action?pageId=55477040&revisedVersion=2&originalVersion=1">View Changes</a>
                |
        <a href="https://docs.jboss.org/author/display/TEIID/Salesforce+Translator?showComments=true&amp;showCommentArea=true#addcomment">Add Comment</a>
            </div>
</div>
</div>
</div>
</div>
</body>
</html>