Posts

Showing posts from December, 2013

Converting SalesForce SOQL results to a Linked Dataset for use by C#

Image
In my last post, I illustrated the 'simple' way of getting the data back - by just creating a Xml Document from the results. This is not always efficient -- in fact, I have gotten out of system memory errors on some queries. In this post I will take the same query and show a little slight of code. The query was: SELECT Name,    (SELECT Name, Email FROM Contacts),    (SELECT CaseNumber, CreatedDate, Subject, Status, Resolution__c,  ClosedDate, SuppliedEmail,SuppliedName FROM Cases    WHERE CreatedDate = LAST_N_DAYS:366     AND Origin != 'Internal'     AND OwnerId !=     '00G40000001RTyyEAG'     AND RecordTypeId IN ('01240000000UTWP', '01240000000UWxM', '01240000000UWxl', '01240000000UWxb')   )   FROM Account    WHERE ID IN (SELECT AccountId FROM Contact Where Email in ({0})) Extension Method to Handle SOQL Result Columns The code ...

Handing Salesforce SOQL Relationship aka Joins in C#

Image
Salesforce SOQL is not SQL which often causes great frustrations to experienced database developers when they work with it. Being of the generation that worked with Network Data Models and Hierarchical Data Model  - i.e. pre-Relational Databases! (as well as database on Tape!), I actually find a lot of "familiar tones" in SOQL. Recently I was needing to build a query that in SQL would be: SELECT Account.Name AS AccountName,    Contact.Name, Contact.Email,    Case.CaseNumber, Case.CreatedDate, Case.Subject, Case.Status, Case.Resolution__c,  Case.ClosedDate, Case.SuppliedEmail,      Case.SuppliedName   FROM Account  JOIN Case ON ... JOIN Contact ON ....  WHERE Contact.Email in ({0})   AND Case.CreatedDate = LAST_N_DAYS:366     AND Case.Origin != 'Internal'     AND Case.OwnerId !=     '00G40000001RTyyEAG'     AND Case.RecordTypeId IN ('0124000000...