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
MC34MC34 

Auto number prefix change via triggers, PB, formula field or workflow?

Hi, 

I have a need to change the prefix of the existing standard autonumber format that starts withn MP- TO CM- for specific record type Custom_Calendar_Marketing_Project While keeping the numeric format same {0000}. I have created the formula field that will display the auto-number in CM- format for the recordtype. 
 
IF(RecordType.Name = 'Custom_Calendar_Marketing_Project', 'CM-'+MID(Name, 4, 5),Name)
This is not working. :(

The datatype for the existing auto-number is currently on "Auto Number". What are the implications of when I change the data type to Text for autonumber for my formula to work? So, this formula only will work when I change the existing autonumber data type to text from autonumber? 

Is formula field is the best or should I use workflow to achieve this? 

I know lots of question. I need to drill on this down to make this work. 

Thank you, 
Natto
Rushikesh KhandaleRushikesh Khandale
Here is a solved question with similar scenario :
https://salesforce.stackexchange.com/questions/222646/auto-number-field-with-variable-prefix

Hope this helps you
If this helps kindly mark it as solved so that it may help others in future.

Thanks and Regards