function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
GrantleyGrantley 

Get Owner field value from C# SOQL query from Contact Query?

I'm using the Office Toolkit interface to submit a SOQL query like this:

 

strQuery = string.Format(

    "SELECT Id, Owner.Extension, LastActivityDate, CreatedDate FROM Contact WHERE "+

    "Phone LIKE \'{0}\' OR OtherPhone LIKE \'{0}\' OR MobilePhone LIKE \'{0}\'", strNumber);

 

QueryResultSet4 result = SFSession.Query(strQuery, false);

 

It works fine, finds the expected record and I can access the Id, LastActivityDate adn the CreatedDate field values by enumerating the fields collection of the QueryResultSet4.  What I can't figure out is how to extract the presumably returned Owner.Extension field.  I think that part of the query is working as if I change it then the query fails.  I just can't figure out how I'm supposed to get at the data for the field...???

 

Thanks!

sdouglassdouglas

Grantley,

 

 

While I am not familiar with the interface you are making these queries in, something to consider, the Extension field is not on the contact, it's from the related Owner (which is a user record).


Hope this helps.

Adam HaithcoxAdam Haithcox
Grantley,

I know this is an old thread, but I was hoping you could expand on how you "enumerated the fields" of the result set? I can't seem to find a way to reference the individiual field values by name with out using the index number. Currently, I can only get a value like:
qr = g_sfApi.Query("select Greer_ID__c from task limit 2", False)

For Each v In qr

    Val = v.Fields(12).value

Next v
I want to be able to reference like:
v.Fields("myFieldName").value

Thanks in advance.