Read about OpenEMR's Response to the COVID-19 Pandemic at

Drug ID not saved when writing a prescription

This is on the latest OpenEMR version (public) 5.0.2. My question is when I prescribe a drug, it looks at the drugs MySQL table and tries to retrieve from there when writing to the prescriptions MySQL table, the drug name is as it appears on the drugs table, but the drug_id is 0. Is there a way to force OpenEMR to write the drug_id as it is in the drugs table to the prescription as well?


The drug_id which is stored in prescriptions table is taken from drug_templates table.
Once an entry to drug_templates table is completed, the drug_id will be stored in prescriptions table.
• Add drugs under Inventory->Management
• Fill in the details.The template field should be filled(as shown below) that is stored in
drug_templates table which holds the drug_id for drugs that are given in prescriptions.

• Add prescription for patient.You will find list of drugs that is added in inventory module .
• The in-house drop down will have template names given during drug creation(mentioned in figure below) and on selected it the values of particular template will be auto populated.

• Once the form is submitted prescriptions table will have drug_id of particular drug similar to drugs table.

For additional clarifications please mail us to


1 Like