You need to sign in to do that
Don't have an account?
Peter Kay 6
access parent object fields in child formula
I've spend days searching and made countless attempts and still cannot get this to work. please help.
I simply want to access parent object fields, in this case the parent account record, in a formula in a custom object that has Account as its parent. From what I read, I should be able to simply state account.name in a formula but I get " Error: Field account does not exist. Check spelling."
I then attempted to duplicate what's in the Salesforce docs https://developer.salesforce.com/page/An_Introduction_to_Formulas which states, "For example, enter Contact.Account.Name to reference the Account Name for a contact associated with a case in a formula field on the Case object."
So I created a custom field in the Case object, then copy/pasted Contact.Account.Name from above. Error message was " Error: Field Contact does not exist. Check spelling.". So apparently the salesforce documented expression doesn't work.
I'm at my wits end, taking 2 days and many hours of attempts, getting nowhere.
It seems something is not right as the field dropdown only shows this in the formula editor in both the Case field test and my own custom object
Please help. If I want to access the account name (or any other account field) in my custom object text field formula. The object is a child of the Account record.
Thank you!
I simply want to access parent object fields, in this case the parent account record, in a formula in a custom object that has Account as its parent. From what I read, I should be able to simply state account.name in a formula but I get " Error: Field account does not exist. Check spelling."
I then attempted to duplicate what's in the Salesforce docs https://developer.salesforce.com/page/An_Introduction_to_Formulas which states, "For example, enter Contact.Account.Name to reference the Account Name for a contact associated with a case in a formula field on the Case object."
So I created a custom field in the Case object, then copy/pasted Contact.Account.Name from above. Error message was " Error: Field Contact does not exist. Check spelling.". So apparently the salesforce documented expression doesn't work.
I'm at my wits end, taking 2 days and many hours of attempts, getting nowhere.
It seems something is not right as the field dropdown only shows this in the formula editor in both the Case field test and my own custom object
Please help. If I want to access the account name (or any other account field) in my custom object text field formula. The object is a child of the Account record.
Thank you!
In your custom object, go to the relationship field and check its api name. it would be something like Account__c. then you can access the account field in the forumula using
relationship name Account__r. so for account name, the expression would be Account__r.name
Also if you have relationship defined, while creating formula, you can click on
Advanced Formula -> insert field -> <your Object> -> <Account> -> account field, then insert to insert the expression in to your formula.
Notice how the field types don't show account and notice the error message when I use "account.name" in the formula field for a CONTACT record.
My specific instance still has problems. First, I confirmed the relation:
Within the Member__c field, the name of the relation is Member__r:
So therefore in the formula, the way for me to access, say PersonAssistantPhone according to your direction would be Member__r.PersonAssistantPhone, correct?
That generates an errror:
Finally, you will notice that that the dropdown on field type does not show any non-system objects, for example in this case it should show the Account record which is in a parent relation.
Please advise.
From the last screenshot above you have posted. It looks as if you are trying to edit the "Default Value" of a custom field using a formula. Rather than actually creating a new field of type "formula". I believe this to be the case because you have:
1. "Always require a value in this field in order to save a record" displaying
2. No object fields to choose from
3. "Use formula syntax: e.g., Text in double quotes: "hello", Number: 25, Percent as decimal: 0.10, Date expression: Today() + 7" gives it away. You can only use non object based formulas in this space.
EG of how to use "Default Value":
https://help.salesforce.com/HTViewHelpDoc?id=fields_useful_default_field_values.htm&language=en_US
To look up the parent object use a formula or you may want to consider a workflow rule if required and based of a condition.
Hope that helps.
If it does please mark this as the favourable answer.
Have a good weekend.
LamCorp