You need to sign in to do that
Don't have an account?
Dr.t
How do I get the data from reference Objects?
Just now, i m developing the tool which can search some data from salesforce objects data by VBA.
I wanna join some tables, but we cannot join some object by SOQL.
So, I try to write the code like below
sid = "SELECT companyCode__r.Name, companyName__c FROM PaymentRequest__c" Set qr = sfApi.query(sid, False) For Each v In qr Set s = v Set sop = s.GetJoinResults("companyMaster__c") Worksheets("test").Range("A1").Cells(irow, 2 + (ci + ci - 1)).value = s("companyName__c ") Worksheets("test").Range("A1").Cells(irow, 2 + (ci * 2)).value = sop("Name") ci = ci + 1 irow = irow + 1 Next
companyMaster__c is refered from PaymentRequest__c by companyCode__c.
But i couldnt get the value of "companyCode__r.Name", and get error message like "Did not set with block variables".
How do I get companyCode__r.Name value.
Is anyone figure out this?
Please help me...
Here is an example of how we have SOQL'ed combining the account and contact objects successfully:
As you can see the ID, Accountid, and Email come from the contact. The AccountNumber and Site come from the Account Object. I hope this helps.