2.5 KiB
#Managing Dynamic Link Fields
Dynamic Link field is one which can search and hold value of any document/doctype. Let's consider an example to learn how Dynamic Link field works.
While creating Opportunity or Quotation, we have to explicitly define if it is for Lead or Customer. Based on our selection (Lead/Customer), another link field shows up where we can select actual Lead or Customer.
If you set former field as Dynamic Link, where we select actual Lead or Customer, then the later field will be linked to master selected in the first field, i.e. Leads or Customers. Hence we need not insert separate link fields for Customer and Lead.
Below are the steps to insert Custom Dynamic Field. For an instance, we will insert Dynamic Link Field in Journal Entry.
Step 1: Insert Link Field for Doctype
Firstly we will create a link field which will be linked to the Doctype.
By Doctype mentioned in the Option field, we mean parent Doctype. So, just like Quotation is one Doctype, which has multiple Quotation under it. Same way, Doctype is also a Doctype which has Sales Order, Purchase Order and other doctypes created as Doctype records.
-- Doctype
---- Sales Order
---- Purchase Invoice
---- Quotation
---- Sales Invoice
---- Employee
---- Production Order
.. and so on.
So linking this field with parent Doctype will list all the Doctype records.
Step 2: Insert Dynamic Link Field
This custom field's type will be "Dynamic Link". In the Option field, name of Doctype link field will be mentioned.
This field will allow selecting document id, based on value selected in the Doctype link field. For example, if we select Sales Order in the prior field, Dynamic Link field will list all the Sales Orders ids.
Bydefault, Docytpe link field will provide all the forms/doctypes for selection. If you wish this field to show certain specific doctypes in the search result, you will need to write Custom Script for it.