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

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. 
Event object

Carlos Campillo GallegoCarlos Campillo Gallego
Hi JH_Neo!

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

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