How to have a button that open a window to a URL that is specified in a custom field

Hi,

I have this custom script :

frappe.ui.form.on("Quality Inspection", "reference_document",
    function () {
        var myWin = window.open("https://google.com");
    });

I want to replace the google.com to a custom field in the same Document called “document_reference_url”

frappe.ui.form.on("Quality Inspection", "reference_document",
    function () {
        var myWin = window.open("https://frm.doc.document_reference_url");
    });

How can I achieve that?

Thank you!

@FredericVerville I believe that you can achieve what you want using the following code.

frappe.ui.form.on("Quality Inspection", "reference_document",
    function (frm) {
        var myWin = window.open(frm.doc.document_reference_url);
    });

Thank you so much, it worked :slight_smile: