I try to use Sales Force API to get some data back. As I found out I can use SOQL instead of SQL that is very similar to SQL. I have a method that is returning some data. I wonder how I can use store procedure instead of using this statement:
SOQL = "select AuthorId,Name, Description,Type from Document";
and this is my whole method:
private void getSomeData()
{
if (!loggedIn)
{
if (!login())
return;
}
QueryResult queryResult = null;
String SOQL = "";
SOQL = "select AuthorId,Name, Description,Type from Document";
queryResult = SfdcBinding.query(SOQL);
if (queryResult.size > 0)
{
for (int i = 0; i < queryResult.size; i++)
{
Document doc = (Document)queryResult.records[i];
string Name = doc.Name;
string Description = doc.Description;
string Type = doc.Type;
string AuthorId= doc.AuthorId;
}
}
else
{
//put some code in here to handle no records being returned
string message = "No records returned.";
}
}
You can't when directly calling the API. Salesforce doesn't have the concept of a stored procedure in SOQL.
If you really want to use stored procedures there are products available, such as DBAMP, that make Salesforce appear as a linked server in SQL SERVER. You can then query it using SQL and use stored procedures etc.
Please note that there is a dedicated stackexchange site for asking Salesforce related questions.