Field to access doctype Series number from doctype script


In the customer doctype if we want to access series number (Name) what field in the doctype to use.

Referring to the image Farmer 1 can be access by field customer_name . what is the field to access CUST-2022-00019 through docType

Hi @amsrk,

Please go to the Selling Setting and set the naming series.
Check-in below image.


pr = frappe.get_doc({
“doctype” : “Contact”, # Supplier DocType
“name” : doc.farmer_first_name,
“first_name”: doc.farmer_first_name, # Supplier Full Name
“last_name”: doc.farmer_last_name, # Supplier Type
“status”: “Passive”,
“email_ids”: email_array,
“links”: link_array

Through script I am updating the Links table in Contact doctype to update the Customer and the corresponding Customer doctype Line

I am trying to populate the links table as follows:

“link_doctype”: “Customer”,
“link_name”: prc
Not sure what to pass for the “link_name”. Both prc and prc.customer_name is returning error
I update the prc value as
prc = frappe.get_doc({“doctype” : “Customer”, “customer_name”: doc.farmer_name})

If this is done will customer_name point to the link?

Check this.


1 Like

I am able to add the email and Phone details (child table ) in the contact doctype through server script. When I try to add the Links table (linking the customer andsupplier to conatct) I have issue.

Not sure value script field name to use to update link_name

*Not sure of the field name to use to update link_name (in the server script)

Hi @amsrk,

I think it will not update id (name) via update method code.
So you can manually set the name/id in the doctype.

Thank You!

In the server script of a new doctype I get the inpiut of details for Customer, Supplier and Contact (email and phone).
From the server script of the new doctype

  1. Create customer (after creation get the link by accessing “name” field)
  2. Create supplier
  3. Create contact with email and phone and also update Links with Customer and “name” (customer)

Hope this design is ok

The error message:


When the link_name child table population is as follows:

“link_doctype”: “Customer”,
“link_title”: prc.customer_name,
“doctype”:“Dynamic Link”