With the current implementation, if you want to query multiple fields from a parent object, the code required is somewhat lengthy:
Query accountQuery = new Query(Schema.Case.SObjectType)
.addField(new SOQL.QueryField(new List<Schema.SObjectField>{
Schema.Case.AccountId,
Schema.Account.AnnualRevenue
}))
.addField(new SOQL.QueryField(new List<Schema.SObjectField>{
Schema.Case.AccountId,
Schema.Account.NumberOfEmployees
}));
System.debug(accountQuery.getQuery());
System.debug(accountQuery.getResults());
In the above example, each parent-level field has to have the chain of fields passed to a constructor for SOQL.QueryField() - it'd be nice if some of the field chain could be reused so Apex devs can write less code to get the same functionality.
With the current implementation, if you want to query multiple fields from a parent object, the code required is somewhat lengthy:
In the above example, each parent-level field has to have the chain of fields passed to a constructor for
SOQL.QueryField()- it'd be nice if some of the field chain could be reused so Apex devs can write less code to get the same functionality.