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

Look for Contact on ContactId.

Here is my code. I have Custom__c object which has Admin person lookup to contacts. I need to find out the details of that contact. So I tried to use this query.
var c = sforce.connection.query("SELECT ID, Name  from Contact WHERE Contact.Id = '{!Custom__c.Primary_ContactId__c}'");
didn't return any records.
 So I tried this to check if Id's are same -
 var c = sforce.connection.query("SELECT ID, Name from Contact WHERE Contact.Name = '{!Custom__c.Primary_Contact__c}'");
var records = c.getArray("records");

first alert i m getting is  - 0033000000ob70wAAB
and second - 0033000000ob75A
Why am I getting different ID's for same contact?
So what should I do to get the detail about Contacts from my custom object?

Perhaps you are getting back multiple records, so you should check records[1], etc and not just records[0]?

What happens if you try to display the user directly?



  I don't want to get multiple records back, thats why I want to search on Contact Id and not on contact name.
If I directly look for I get the contact detail information under contacts tab.
Is it so hard to find one user in contacts object on ID?
your first query should be select id, name from contact where id = '....' and should work fine.