[SalesForce] Person Account Contact ID in Spring 13

I have a custom object that looks up to Contact. On the Person Account Detail page, I have a custom button on the related list for this custom object. In production, this button references {!Contact.ID} which pulls the Contact ID of the Person Account.

However, in my Spring '13 sandbox, this no longer seems to work. The merge field is returning a blank value. I tried {!Account.PersonContactID} but this field is not accessible so I cannot save the button. Also {!Account.ID} will not work as I am using this button to populate the Contact lookup on my custom object.

Did something change in Spring 13 that caused this functionality to stop working?

Best Answer

I've done exactly what you wrote and I had the same awful results.

Options:

  1. Apparently Salesforce is inviting you to add an Account lookup relationship to your Custom Object, update that field for all your records and then delete the Contact field. This way you will not need to use any custom button.

  2. The only other thing that could work for you is creating a Apex WebService to retrieve the PersonContactId, the javascript button might look like this:

    var id = '{!AccountId}'; 
    var val = sforce.apex.execute("Utility","getContactId", {Id : id});
    

    Where Utility is your Class and getContactId your webservice, and inside your class the SOQL query:

    SELECT Id, PersonContactId FROM Account where Id = '001XXXXX'
    
Related Topic