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
ios4lifeios4life 

Trying to get primary contact info only

Hello everyone,

 

I am brand new to the Salesforce platform and am trying to use a SOQL call to get primary contact information such as first name, last name, address, email, phone, etc...

 

I have searched through the message boards and found this answer:

 

http://boards.developerforce.com/t5/General-Development/trouble-getting-primary-contact-info/m-p/126046#M29243

 

with this solution query:

 

Select a.Contact.FirstName, a.Contact.LastName, a.ContactId From AccountContactRole a WHERE a.IsPrimary =true and a.AccountId = 'priamry account id'

 

However, when I try this I get this result:

 

(

)

 

Does anyone know what could be causing this? Do I need to have anything set up on my account before I will be able to fetch my own contact info??

 

Thanks in advance,

~Arash

Cloud on FireCloud on Fire

Is 'a' an Account or a Contact? Because in the first part of your query it looks like an Account but in the 2nd part like a Contact.

ios4lifeios4life

From my limited understanding it is creating an 'AccountContactRole a' during the FROM clause so a should be an AccountContactRole

sfdcfoxsfdcfox

Your query is correct. The fact that you did not get a SOAP fault of MALFORMED_QUERY suggests that you executed your query correctly. You're probably asking the wrong question here. You're apparently using PHP to code your integration based on that example output. You're probably also using print_r to try and dump the data. That may not work, because the member variables are encapsulated and may not print out using print_r. If you're using the PHP Toolkit, use the samples in the documentation that came with the toolkit, and if you're using SoapClient directly, you'll need to grab the results directly from the SoapClient; SoapClient will have member variables such as "done" (true if there was there no more records), and "records" (an array of SObject records). Finally, make sure that the ID value is correct (a.AccountId = '<account id>'). If it's not 15 or 18 characters, or if you don't have access to that account, you won't get an error, but you won't get any results either.

ios4lifeios4life

I'm not sure which medium I am using, it's all being done through iOS and so to dump that data I am simply calling [[result records] description] and writing it to my log. I am attempting to use the <account id> that was returned when I logged in, which is a 15 digit code. I should have access to my own account information, shouldn't I? Or maybe I have to turn on access somehow in the dashboards?

sfdcfoxsfdcfox

So, you're using Objective-C for Apple, and compiling the code for a mobile device, then. I presume you're using the iOS toolkit? I'll take a look and see if I can figure out what might be the snag.