Custom Action in Link Field

You can add a new custom link option to the standard link field by defining the function in the namespace frappe.ui.form.ControlLink.link_options.

In the frappe.ui.form.ControlLink.link_options, you have access to the link field object.

1. Adding Custom Option

frappe.ui.form.ControlLink.link_options = function(link) {
    return [
        {
            html: "<span class="text-primary link-option">"
                + "<i class="fa fa-search" style="margin-right: 5px;"></i> "
                + __("Custom Link Option")
                + "</span>",
            label: __("Custom Link Option"),
            value: "custom__link_option",
            action: () => {}
        }
    ];
}

Once a function is assigned to frappe.ui.form.ControlLink.link_options, the link field will have a new link option:

182354398 c1fc9f55 4464 4683 bb74 982ec2546f71