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
MRK.ax399MRK.ax399 

Custom Record ID using auto number

I need to create a custom record id based on certain fields and append an auto generated # to the ID. I have an auto generated id field in the object and and am creating the custom record by concatenating the fields with auto #.
 
I implemented this using an apex after insert trigger, but ran into the error 'record is read only'. If I implement this code in a before triger, the auto number is not getting generated.
 
Any suggestions on resolving this?
 
Thanks
M
SuperfellSuperfell
Can't you just use a formula field ?
MRK.ax399MRK.ax399
Thx. I will try that. Will the formula field searchable? Users need the ability to search based on this field 
developer-forcedeveloper-force
Yes, I think the record id for an SObject is searchable. The default search provided also searches on the record id.