Fetch Field Triggers Permission Denied Error with Select-Only Permission on Linked Doctype

When a user has only the select permission on a Doctype and uses a screen with a Link field pointing to that Doctype, an error occurs when selecting a value.

This happens because a Fetch field depends on the Link field to get additional data. The system tries to fetch the data but throws a “Permission Denied” error, saying the user needs read permission on the Doctype.

How can I make the Fetch work without requiring read permission, only using the select permission?

You will have to write a custom script to make that work.
custom script example
JS code

frappe.call({
    method: 'your_custom_module.path.to.get_linked_doctype_data',
    args: {
        link_docname: frm.doc.link_fieldname 
    },
    callback: function(response) {
        if (response.message) {
            frm.set_value('fetch_fieldname', response.message);
        }
    }
 });

python file code

@frappe.whitelist()
def get_linked_doctype_data(link_docname):
    return frappe.db.get_value('LinkedDoctype', link_docname, 'field_to_fetch')