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
PlainviewPlainview 

Advanced Formula Field Syntax to Standardize Naming Convention for Opportunities associated with Person Accounts

Hello,

I have standardized our Opportunity naming convention via a Workflow Rule and  (Formula) Field Update, which works great with regular Accounts:

IF (RecordType.Name  = 'Safari New',
TEXT(YEAR (CloseDate)) & "  -  " & Account.Name & "  -  " & TEXT (Product_Type__c) & "  -  " & TEXT(Type)  & "  -  " & TEXT (Number_of_Users__c) & " Users","")

However, this does not work for Person Accounts - Account Name does not populate.

I'm trying to add to the formula field syntax to account for Opportunites associated with Person Accounts but am having trouble writing the formula field syntax. So far I have:

IF(Account.PersonContact.RecordTypeId = '0120000000099Lo',
&&(AND(RecordType.Name  = 'Safari New',
TEXT(YEAR (CloseDate)) & " - " &  Account.PersonContact.Account.Name & " - " & TEXT (Product_Type__c) & " - " & TEXT(Type)  & " - " & TEXT (Number_of_Users__c) & " Users",""))

... but this does not pass the syntax check. I'm convinced it's something relatively simple, so was hoping for some insight as to what Function or Operator I'm missing or have imput incorrectly.

Thanks so much!

Best,
Julien
Best Answer chosen by Plainview
PlainviewPlainview
Here's the solution:


It lies in singling out the the non-Person Account related Opps., first in the formula; then setting the Person Account related Opps. logic to pull the FirstName and LastName.

Final formula that works and has passed all tests:

IF( Account.IsPersonAccount = False, 

IF (RecordTypeId = '0120000000097QC', 
TEXT(YEAR (CloseDate)) & " - " & Account.Name & " - " & TEXT (Product_Type__c) & " - " & TEXT(Type) & " - " & TEXT (Number_of_Users__c) & " Users","")& 

IF(RecordTypeId = '0120000000097QH', 
TEXT(YEAR (CloseDate)) & " - " & Account.Name & " - " & TEXT (Product_Type__c) & " - " & TEXT(Type) & " - " & TEXT (Number_of_Users__c) & " Users","")& 

IF(RecordTypeId = '0120000000097QM', 
TEXT(YEAR (CloseDate)) & " - " & Account.Name & " - " & TEXT (Product_Type__c) & " - " & TEXT(Type) & " - " & TEXT ( Existing_Users__c ) & "/" &( TEXT(Number_of_Users__c ) & " Users"),"") , 



IF (RecordTypeId = '0120000000097QC', 
TEXT(YEAR (CloseDate)) & " - " & Account.FirstName & " " & Account.LastName & " - " & TEXT (Product_Type__c) & " - " & TEXT(Type) & " - " & TEXT (Number_of_Users__c) & " Users","")& 

IF(RecordTypeId = '0120000000097QH', 
TEXT(YEAR (CloseDate)) & " - " & Account.FirstName & " " & Account.LastName & " - " & TEXT (Product_Type__c) & " - " & TEXT(Type) & " - " & TEXT (Number_of_Users__c) & " Users","")& 

IF(RecordTypeId = '0120000000097QM', 
TEXT(YEAR (CloseDate)) & " - " & Account.FirstName & " " & Account.LastName & " - " & TEXT (Product_Type__c) & " - " & TEXT(Type) & " - " & TEXT ( Existing_Users__c ) & "/" &( TEXT(Number_of_Users__c ) & " Users"),"") 

)