Hello!
In Frappe, we can use the frm.set_query method to apply filters on link fields. However, even after applying filters, if a user copies the ID of a record that does not match the filter criteria and pastes it into the link field, Frappe still accepts it.
Example:
I have a Contact link field. In the Contact master, there are both Indian and foreign numbers.
I want the link field to show only Indian numbers. Using frm.set_query, this can be achieved.
But if someone copies the ID of a foreign contact and pastes it into the Contact link field, it gets accepted—even though it’s not in the filtered list.
I want to restrict this behavior so that only records matching the filter can be selected.
Can anyone help me with this?