Can someone help me with syntax in "Fetch From"?

I have created a simple custom field in the Customer record that contains up to 12 characters. The field represents an additional “Customer ID” that is different from the native ERPNext customer ID. We use this additional information to help correlate ERPNext customers to the same customer in a different 3rd party system.

All of this part I already have in place and working.

Now, I have also added the same field to the Sales Invoice. In both cases the field is called [jmi_customer_id].

I want to populate the field in the Sales Invoice automatically when an invoice is created. From what I understand this is done by using the “Customize Form” for the Sales Invoice page and adding a “Fetch From” command to the field to tell it to grab the [jmi_customer_id] field information from the “Customer” record.

So my question is:

When I am in the Customize Form section of the Sales Invoice, what syntax would I use to get the [jmi_customer_id] data from the customer record?

See below:

Any assistance here would be greatly appreciated.

Thank you,

BKM :nerd_face:

1 Like


Would a Type: link work ala ?

Hi @bkm,

  1. First, find the field in ‘Sales Invoice’ that is the Link to Customer. What is that field’s name?

In this case, the answer is “customer”. So that is the prefix you need.

  1. Next, what is the name of the target field? In your case, “jmi_customer_id”. That’s the suffix.

So in your “Fetch From”, enter this:


This tells the ERP to:

  • Examine the ‘customer’ field.
  • Jump to whatever it’s Linked to.
  • Fetch a field named ‘jmi_customer_id’

Thanks @brian_pond for the most concise explanation of the process I could have ever hoped to receive!!

Works Perfectly!


This turns out to be the link to the documentation in the online manuals for the entire process of creating links and then fetching field information. While not as concise and easy to understand as the answer from @brian_pond , the information is all there (if you can follow the flow and style of the author). It was just not as easy for me to understand.


1 Like

I liked @brian_pond 's answer better too :slightly_smiling_face:

1 Like

Semi-relatedly, Virtual docfields seem to be in the pipeline for v14.

There’s still definitely a use-case for Fetch From, but it will be great to have a more semantic approach available in the future.