i create a custom field in lead doctype name = ‘custom_ref’ i want this field use for creating refrence no
I want that when new lead create from webform or indiamart etc . then in this field current date time show
i use server script for this then lead not create (web form not submit)
if not doc.custom_ref:
doc.custom_ref = frappe.utils.now_datetime().strftime('%Y%m%d%H%M%S')
when i remove this line (.strftime(‘%Y%m%d%H%M%S’))
if not doc.custom_ref:
doc.custom_ref = frappe.utils.now_datetime()
import frappe
from frappe import _
def before_insert(doc, method):
if not doc.creation:
doc.creation = frappe.utils.now_datetime().strftime('%Y%m%d%H%M%S')
or create a demo.py file and write this code in this and hook in hook.py file provide path