Set specific values in a field type Link

Hello everyone, I am new using frappe erpnext, I have a link type field that points to the Doctype Countrys, but I need to select only one type of data to show only the countries that have that associated data. Since not all countries have that additional information.

Thank you for your kind help.

You can add a filter via Javascript:

cur_frm.fields_dict.FIELD_NAME.get_query = function(doc,cdt,cdn) {
		return {
			filters:[
				['ASOCIATED_DATA_FIELD_NAME', '=', "VALUES"]
			]
		}
	}

You can replace the condition whit other that fit your case, for example β€œin” (in which case you should provide a list of values in β€œVALUES”), or β€œ!=” or others.

1 Like

In Doctype principal I have a field that focus on Country doctype, but in the doctype country I have a child table with the aditional information, In this case i need that show only the country name that have data in the child table.

Try with β€œ!=” and null:

['ASOCIATED_DATA_FIELD_NAME', '!=', null]
2 Likes

Thanks for you kind help

1 Like