Hello i am new here and i am building a custom app and want to prevent the user from creating multiple ERPNext Companies through my app how to do it through my app
any help will be appreciated
You can set this in your server script or in the before_insert
hook for the Company doctype.
# Fetch all existing companies
existing_companies = frappe.get_all('Company')
# Check if there are any companies in the system
if len(existing_companies) >= 1:
frappe.throw("You cannot create more than one company.")
1 Like
Thank you that worked
I am new to frappe so that was really helpful