Only custom option in the link field

Hello,

I am trying to link a field to the ‘Traite’ doctype and I add a custom option to the link field. How can I hide ‘Create a new Traite’ and ‘Advanced Search’ options from the link, and only the custom option remains

Capture d’écran du 2023-11-20 16-17-09

the custom option here is Recherche avancé

Use “Role Permission Manager”
Uncheck “Create” option for that role.

1 Like

I want only to hide options and keep only the custom option for this field and not disable create permission to doctype

:melting_face::melting_face::melting_face::melting_face::melting_face:

1 Like
frappe.ui.form.on('Your DocType', {
    refresh: function(frm) {
        frm.fields_dict['your_link_fieldname'].get_query = function(doc, cdt, cdn) {
            return {
                filters: {
                    // Your filters go here
                },
                no_create: 1, // Disable "Create New Item"
                query: 'erpnext.controllers.queries.linked_document_query',
                searchfield: 'item_code'
            };
        };
    }
});
1 Like

i do it but not work

Try this

Syntax

cur_frm.set_df_proprty(<YOUR_FIELDNAME>, "only_select", 1)

my fieldname is employee

cur_frm.set_df_property('employee', 'only_select', 1)
1 Like

this " only_select" hide all options but in my case I want keep only the custom option created and hide the others options CREATE NEW and ADVANCED SAERCH

better go with the jQuery it will help. i don’t know how to do but it will give some idea Thank you.