I'm not sure my question will be able to be answered, but if anyone can help, it will be greatly appreciated.
I'm using a webservice to make calls into SalesForce.com API. We use SalesForce as our CRM system. SalesForce uses a proprietary version of SQL called SOQL. It has limitations on joins, aggregates and other functions that regular SQL uses. One limitation might be the use of the IF EXISTS statement, but I haven't found any documentation that says I can't use it.
I'm trying to do the following:
I want to write a function that checks if a record exists in one of the objects (tables) we have on their system and return true if the record exists and false if the record does not exist.
I want to use the function in an if statement and branch based on the return value of the function If (function returns true) { do some processing here... } else { do some other processing... } The function would use the 'if exists' in the SOQL query to determine if a record exists in the contact object and return true or false.
IF EXISTS (Select c.Email, c.FirstName, c.HasOptedOutOfEmail, c.LastName from Contact c WHERE email = '[email protected]') SELET 1 ElSE SELECT 2
I can't get this to work using SOQL, which might not allow the IF EXISTS statement. Is there another method to accomplish the same thing? Any code samples, examples would be helpful. Thanks for any help.
|