Fetch the BOM no. to be linked with serial number of an Item

I have 4-5 BOM’s for a particular product. I want a serial number based on the BOM used for manufacturing. I have created different names for different BOM’s of a particular item and I want the serial number to be like this:
BOM no .#####

I have tried fetching data by putting {{ frappe.db.get_value(“BOM”, doc.BOM, “BOM_no”) }} .##### in the serial number of an item but I am getting this error - 1.0 Serial Numbers required for Item NX/SSDCB/0001. You have provided 2.

It would be great if someone can help. Thanks in advance.