+ Start a Discussion
HNT_NeoHNT_Neo 

Formula for Account or Opportunity and RecordType Name

Hi all, 

Looking for the formula to insert a value when either an account or opportunity name and record type name are selected. 

I was able to create a formula to insert an account name and the record type name separated with a -

Account.Name + ' - ' + $RecordType.Name

The result example is: ACME - Exterior Multichannel

However, now I want to enter an Opportunity into the formula and depending on which object this formula is pulling it from, Account or Opportunity, it should select the record type. 

This is my attempt in creating the formula but isn't working do to the incorrect synatx: 

(Account.Name + ' - ' + $RecordType.Name)||
(OpportunityName + ' - ' + $RecordType.Name)

Thank you in advance :)

Waqar Hussain SFWaqar Hussain SF
Can you please explain on which object are you creating this formula field. 
HNT_NeoHNT_Neo
Event object

Thanks!
Carlos Campillo GallegoCarlos Campillo Gallego
Hi JH_Neo!

Have you tried to use CASE (...) function? I think that this'd solve your problem :)

Regards
Ronald OlechRonald Olech
Try something like:
IF(NOT(ISBLANK(Account.Name)),
    (Account.Name + ' - ' + $RecordType.Name),
    IF(NOT(ISBLANK(Opportunity.Name)),
       (OpportunityName + ' - ' + $RecordType.Name),
       "default name when no account or opp"
       )
)
HNT_NeoHNT_Neo
User-added image