Concretio

View Original

WSC SObject handling Lookup, Child relationships and XPath queries !

This post explains how to best handle/access  primitives, lookups and child relationships, when working with Partner-Sobject compiled from Salesforce WSC WSDL complier.

For ease of explaining, a sample SOQL query that will include both a lookup and a child-relationship over Contact SObject will be used. Here is the query

/**
 * SOQL for loading contact with some fields, lookup and child relationship
*/
static String SOQL = "Select FirstName, LastName, Name, Account.Name, AccountId , (Select Id, Title, Body From Notes), (Select Id, Priority, CreatedBy.Name, CreatedById From Cases) From Contact where AccountId  != null and Id = 'recordid goes here'";

Read More: https://abhinav.fyi/wsc-sobject-handling-lookup-child-relationships-and-xpath-queries/