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
degmodegmo 

Generate values for a custom number field

Hi All,
I have custom field on a custom object called Review.  It has a field called Review_Number__c that is supposed to be generated as follows:  last two digits of current year followed by the last 8 digits of Review_Number__c from the most recent record plus one.  

So, if the most recent review record has a Review_Number__c of 2012345678, the new record that gets inserted today will get the number 2012345679.  If today was 1/1/21, then the new record that gets inserted will get the number 2100000001. 

I already have a flow that does executes other business logic when a review record gets created and was thinking I can build the formula in the flow but not sure if that the most optimum solution.  Can it be done in a flow?  If so, i can use some guidance.  Much appreciated.
ShirishaShirisha (Salesforce Developers) 
Hi,

Greetings!

Yes,it can be done in flow using the formula while creating the new record otherwise,you can simply create the formula field of type number to update the Review_Number__c.

Kindly mark it as best answer if it helps so that it can help others in the future.

Warm Regards,
Shirisha Pathuri
degmodegmo
Hi Sirisha,
I don't know how a formula field could work because it won't allow me to get the latest Review_Number__c field.  Am I missing something?