Add a link field and filter its options
A Link field points to a document of another DocType. For example, the Customer field of a Sales Order links to the Customer master. The user selects a customer from a dropdown, and can open it from the field.
Prerequisites
- The System Manager role.
Add the link field
- Open Customize Form for the DocType, for example Quotation.
- Add a field where you want it.
- Enter the Label, for example
Project. - Set the field type to Link.
- In Options, enter the DocType to link to, for example
Project. - Select Update.
Filter the options of a link field
You can limit the documents that a link field offers. For example, a Company field can offer only some companies.
- In Customize Form, open the link field in the form builder.
- Select the filter icon of the field.
- Add the filters, and select Apply.
- Select Update.
To go back to the standard filters, select Reset To Default. Filters that you set in Customize Form replace the standard filters of the field.
Filter on a value of the form
A filter value can come from another field of the form. Write it as eval: and an expression:
eval: doc.companyuses the value of the Company field.eval: doc.fieldname1 + doc.fieldname2combines two fields.
In a child table, you can use two kinds of values:
doc.<field name>: a field of the same row.parent.<field name>: a field of the parent document.
INFO
A filter that a client script sets with frm.set_query takes priority over a filter that you set in the UI.