Skip to main content

Dynamic Link Field in ERPNext

A Dynamic Link field is a field that can search and store values from any DocType. It is used when the target DocType is not fixed and depends on another field’s value.

For example, while creating an Opportunity or Quotation, you may need to select whether it is for a Lead or a Customer. Based on this selection, the next field dynamically changes to show records from the selected DocType.

Instead of creating separate Link fields for Lead and Customer, a Dynamic Link field handles both cases using a single field.

Example Use Case

If you select Lead or Customer in the first field, the Dynamic Link field automatically fetches records from the selected DocType.

 

Step 1: Insert Link Field for DocType

First, create a Link field that points to the DocType master. This field will define which DocType the Dynamic Link should refer to.

In ERPNext, DocType is a master that contains all system documents such as:

  • Sales Order
  • Purchase Invoice
  • Quotation
  • Sales Invoice
  • Employee
  • Work Order

 

Step 2: Insert Dynamic Link Field

Next, create a field with type Dynamic Link. In the Option field, enter the name of the Link field created in Step 1.

 

This field will dynamically load records based on the value selected in the DocType Link field. For example, if Sales Order is selected, it will show all Sales Order records.

 

Customization

By default, the DocType Link field shows all available DocTypes. If you want to restrict the list to specific DocTypes, you need to use a custom script.

Rating: 0 / 5 (0 votes)