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
KirstyFranceKirstyFrance 

Custom Formula Field on a Custom Object

I am trying to create a custom formula field on a custom object that is a child object to the account object. The formula sets the value of the field based on a picklist value on the account object. It works fine when I try it on a custom field on the asset object, but on my custom object I get a syntax error. 

 

When I use Account.CurrencyIsoCode to reference the currency field on the related account, I get the error "Field account does not exist". 

 

Does anyone know if formulas on custom objects work differently to standard objects?

 

Best Answer chosen by Admin (Salesforce Developers) 
Steve :-/Steve :-/

Try referencing this in your formula

 

Account__r.CurrencyIsoCode

 

 

 

All Answers

Steve :-/Steve :-/
Can you post your formula using the Code Clipboard and include the field names and datatypes.  Also what is the relationship between your custom object and the account object?  is it Master-Detail or just Parent-Child?
Steve :-/Steve :-/

Try referencing this in your formula

 

Account__r.CurrencyIsoCode

 

 

 

This was selected as the best answer
KirstyFranceKirstyFrance

Hi Stevemo,


Thanks for the reply. I've tried your suggestion of adding _r, this morning and it still gives the same error. The code that used for a similar filed on another object is: 

IF(ISPICKVAL( Account.CurrencyIsoCode , "EUR"), "EUR", IF (ISPICKVAL( Account.CurrencyIsoCode , "SEK"), "SEK", IF(ISPICKVAL( Account.CurrencyIsoCode , "CHF"), "CHF", "GBP")))

 

 

KirstyFranceKirstyFrance

Hi Again,

 

Forget that. I forgot it should be a double underscore for the __r. It is not giving an error anymore! Thanks 

 

Steve :-/Steve :-/

No problem that one always trips me up too.  Glad it worked for you.

 

S:-/