0

I got to explain well the scenario.

I have a custom obj with 10 different Records Types.

I want the name field (which at the moment is an autonumumber with the following format {YYYY}{MM}{DD}{0}) to be "named" also based on the record type.

So name would be something similar to this: PP 20230216-0001 or PP202302160001 where PP is a prefix that indicates one of the 10 record types.

Things tried:

I created another field (formula field) with the formula to choose the prefix based on RecordType and then to append the Name field but doesn't work.

I created 2 Custom fields, one containing the formula to find the right prefix and another Custom field to Copy the value in the field "Name". Didn't work.

Do you guys have any suggestions?

I can explain better what I have tried.

Named the new formula field Campaign_Id

then tried different formulas, this one is one of the few that worked.

IF(RecordType.Name = "Enterprise Ad", "ED" & Name, IF(RecordType.Name = "Enterprise Article", "EA" & Name, IF(RecordType.Name = "Enterprise Banner", "EB" & Name, IF(RecordType.Name = "Enterprise Newsletter", "EN" & Name, IF(RecordType.Name = "Enterprise Profile Optimization", "EO" & Name, IF(RecordType.Name = "Enterprise Project Optimization", "EP" & Name, IF(RecordType.Name = "Premium Ad", "PD" & Name, IF(RecordType.Name = "Premium Article", "PA" & Name, IF(RecordType.Name = "Premium Profile Optimization", "PO" & Name, IF(RecordType.Name = "Premium Project Optimization", "PP" & Name, "")))))))))))

Must have worked 2/3 times then it started copying only the Name Autonumber value....I'm stuck in here.

1
  • You should use a CASE statement rather than nested IFs
    – cropredy
    Feb 17, 2023 at 21:15

1 Answer 1

0

The value in the formula field will be only available after a record is created.

You can make use of record triggered flow with fast field update option if you are okay with using External Id instead of the auto-increment number.

The sample format will look like this.

{YYYY}-{MM}-{DD}-{EXTERNAL_ID}-{RECORD_TYPE_NAME}

You would need to create a new formula resource in the flow which will look like below syntax.

TEXT(Month({!$Flow.CurrentDate}))+"-" +TEXT(DAY({!$Flow.CurrentDate}))+"-" +TEXT(YEAR({!$Flow.CurrentDate})) & "-" &  
TEXT({!$Record.Ext_Id__c}) & "-" & {!$Record.RecordType.Name}
1
  • I'm ok using an external Id, this ID field is meant to make sense to our Marketing team only. what I don't understand at this point how come my formula worked a couple of times... Feb 17, 2023 at 15:41

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .