3

May be a basic question but I could not find specific documentation and I need to find out all objects where:

The accountid field is NOT available as a merge field is a javascript button.

In these cases one would have to use {!Account.Id}.

The two that I know of so far where it is NOT allowed are (although it is available via SOQL and describe):

  1. Contact
  2. Order

It IS allowed on the opportunity though.

Bonus Is there a way to programatically tell in the describe information if the field is not available for a JS merge field and needs to be transformed to Account.Id

Also any links to documentation would be helpful.

3

May be a basic question but I could not find specific documentation and I need to find out all objects where:

The accountid field is NOT available as a merge field is a javascript button.

Task, Event, Quote, Contact, and Order.

Bonus Is there a way to programatically tell in the describe information if the field is not available for a JS merge field and needs to be transformed to Account.Id

No. They describe like any other field, and don't have any special flags that indicate anything's different.

Also any links to documentation would be helpful.

I agree. However, as far as I can tell, there is not, and never has been. If it did exist, I have not found it. I believe it has to do with a limitation in the merge syntax for URLs. Unlike newer technology in Salesforce, you can't go across relationship names, so salesforce.com implemented a bunch of convenience fields.

For example, you can't say {!Case.Account.Name} because of the no-relationship rule, but instead Salesforce allows you to write {!Account.Name}. You'll also notice other oddities, like instead of {!Case.Owner.FirstName} you can write {!Case.OwnerFirstName}. Unfortunately, the best I can say is that you have to use the UI to know for certain if a field will be recognized.

| improve this answer | |
  • AccountId works on case. Thanks for the Event and Task. – Eric Jan 30 '19 at 3:49
  • @Eric Oh, I just assumed you'd checked it. I'll amend that then. It's a very small list of magic fields. – sfdcfox Jan 30 '19 at 3:53
  • Ahh, mistype in my question, it should be contact not case. I'll fix it. Glad to know it is a small list. One of those things you just need to be aware of I guess. – Eric Jan 30 '19 at 3:54
  • @Eric I knew it was one of those "C" objects, at any rate. Hopefully no more of them will appear (I checked WorkOrder, thinking it might not have it, but it does), so that should be the entire list. – sfdcfox Jan 30 '19 at 4:01

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.