Hello Guys,
dose somebody know why i get a DoesNotExistError exception and not new_lead?
What wold bee a right approach?
Thanks in advance
data = frappe.form_dict
# Search for the lead by email ID
existing_lead = frappe.get_doc("Lead", {"email_id": data.email})
if not existing_lead:
# Create a new lead
new_lead = frappe.get_doc({
"doctype": "Lead",
"first_name": "John",
"email_id": "example@example.com",
})
frappe.response['message'] = new_lead
else:
frappe.response['message'] = existing_lead
ERPNext: v14.14.0