2

Using the Salesforce SOAP API to query some data from accountContactRole table. What is the best way to get a relationship value from the query result. When I perform the query in workbench or developer query editor it returns the correct data but I need to know how from my SOAP API VB.NET code would I get the Contact.Contact_Number__c value from the queryResult object?

 soql = String.Format("SELECT AccountId, ContactId, Contact.Contact_Number__c FROM AccountContactRole where accountid = '{0}' and role = '{1}' limit 1", salesforceAccountId, roleName)

        qr = binding.query(soql)
        If qr.records.Length = 1 Then
            Return qr.records(0) <<<<<<<----------- How to pull out contact.contact_number__c
        End If
2
  • It should be as simple as qr.records(0).Contact.Contact_Number__c, isn't it?
    – sfdcfox
    Commented Oct 26, 2016 at 20:07
  • @sfdcfox that is what I initially tried but didn't work, once I cast the value to the AccountContactRole I was able to get at the properties from my answer I posted below.
    – maguy
    Commented Oct 26, 2016 at 20:10

1 Answer 1

2

Figured out how to do this by casting the queryResult to an AccountContactRole and voila!

(DirectCast(qr.records(0), EnterpriseSF.AccountContactRole)).Contact.Contact_Number__c

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .