I've a trigger on a custom object Object_A__c
. Now, I need to populate a receipt number id in a field receipt_id__c
.
There are two types of receipts X and Y namely. I need to populate the receipt_id__c
with X-001, X-002,etc., and similarly Y-001, Y-002, etc.,. i thought of using AutoNumber
field but got stuck since its the same object I'm working on and the auto number field increments for each record irrespective of the type of receipts. I need to handle bulk insert as well.
How should I proceed now?
Thanks in advance!