Add Button to Form to Open Hyperlink for Item

I’m sure this is embarrassingly easy…

I’ve added a custom Button field to the Item DocType, along with a data field. I would like the user to be able to paste an external hyperlink in the data field, which is then used by the Button field to open that external hyperlink for the item on click.
Can anyone point me in the right direction?

Thanks,
Paul

Hi @pmjd,

Please apply custom/clinet script.

Button: button_field_name
Data field: your_data_field

frappe.ui.form.on('Item', {
	button_field_name: function(frm) {
	    var openlink = window.open(frm.doc.your_data_field);
	}
});

When the user pastes the URL in the Data field and then clicks the Button then will open the link according.

Please set your field according to.

Thank You!

1 Like

Thank you @ncp working perfectly :slight_smile: