How to generate naming Series With field name but number will continues

Hello,
I have one custom field - name “custom_vendor” field type is select
there is 2 option Saeed, Majid, Rahul.

when we choose vendor Saeed naming series want like this ID- S -01
then next we choose vendor Majid naming series want like this ID- M -02
then next we choose vendor Sajid naming series want like this ID- R -03

Like this i want but when we use this things

I get out-put like this
vendor Saeed naming series want like this ID- S -01
vendor Majid naming series want like this ID- M -01
vendor Rahul naming series want like this ID- R -01

Thank You.

@falah123 check this Doctype Naming Rule

Thanks for your reply,

I tried but not work
I want letter S M R should be dynamic but number continues
but when i use this the out-put like this

vendor Saeed naming series want like this ID- S -01
vendor Majid naming series want like this ID- M -01
vendor Rahul naming series want like this ID- R -01

Is it possible in the ERPNext?

Can anyone guide me.

To set up a custom naming series in ERPNext based on the first letter of a vendor’s name, you need to add a custom field to capture the first letter and then configure the naming series to use this field.
This Format : ID.-.{fieldname}.-.##

while using your solution on every Vendor the Counter number is Start from 1 example

vendor Saeed naming series want like this ID- S -01
vendor Saeed naming series want like this ID- S -02
vendor Saeed naming series want like this ID- S -03
vendor Saeed naming series want like this ID- S -04

vendor Majid naming series want like this ID- M -01
vendor Majid naming series want like this ID- M -02
vendor Majid naming series want like this ID- M -03

vendor Rahul naming series want like this ID- R -01
vendor Rahul naming series want like this ID- R -02

But i want like this :point_down:

vendor Saeed naming series want like this ID- S -01
vendor Saeed naming series want like this ID- S -02
vendor Saeed naming series want like this ID- S -03
vendor Saeed naming series want like this ID- S -04

vendor Majid naming series want like this ID- M -05
vendor Majid naming series want like this ID- M -06
vendor Majid naming series want like this ID- M -07

vendor Rahul naming series want like this ID- R -08
vendor Rahul naming series want like this ID- R -09

Kindly check this