Getting a List of Available Salesforce Objects
How do you determine what objects, specifically tables and columns, Salesforce makes available?
To get a list of tables, you use a special SOQL query using the command LIST TABLES. This query will return a list of table names; these names, in turn, can be subsequently used with LIST to retrieve the columns for each table. Here are some examples of the code to put this in action:
As shown above, a simple Data Table and DataLayer.SQL element are used to retrieve a list of tables from Salesforce. The special SQL query syntax "LIST TABLES" is used in the datalayer's Source attribute.
The results returned from Salesforce can be accessed using the special Data token @Data.rdSalesforceTable~, as shown above,
and the output will look something like the example above.
Once the table names have been acquired, they can be used in a query to retrieve a list of the columns for a particular table.
In the example above, a second Data Table is used to list the columns associated with one of the Salesforce tables. The SOQL query syntax is LIST <table name>, and in the example, a table name has been hard-coded into the query. A more sophisticated solution might use a table name selected from the displayed results of the previous (LIST TABLES) query to drive the second query, using a request token: LIST @Request.TableName~, for example.
And finally, as shown above, another special Data token @Data.rdSalesforceField~ is used to display the Salesforce table column information the query retrieved.
The output would be a list of columns, as shown above.
By combining the techniques shown here, developers can access data stored on Salesforce and incorporate it in their Logi applications.