Try ERPNext Buy Support Partners Foundation

Custom button opening URL

Need add a button which open a URL, for example:

frappe.ui.form.on("Purchase Invoice", "refresh", function(frm){
	frm.add_custom_button("Link", function(){
			my_button.onclick=window.open(https://erpnext.com)
	});
});

Worked with:

Opening in the same tab:

frappe.ui.form.on("Purchase Invoice", "refresh", function(frm){
	frm.add_custom_button("Link", function(){
			window.location.href = "http://google.com";
	});
});

Opening a new tab:

frappe.ui.form.on("Purchase Invoice", "refresh", function(frm){
    frm.add_custom_button("Link", function(){
			var myWin = window.open('https://google.com');
	});
});
1 Like

Dear @Leonardo_Augusto please help me.
I need a custom script that open certain URL (URL here is login page) and after open the url I need the script to fetch the user name and password from some doctype then put them in login page automatically.
Awating your response.

Hello @dufani1, happy new year!
Sorry for late, but can you show us the page in specific?

Hii @Leonardo_Augusto happy new year and I wish you a good year.
I need to open webmail from ERPNext, instead of using inbox.
I will create button in employee doctype and when employee click this button the new tab login page open with username and password inserted in this page, the username and password will fetch from user doctype.
this is the login page: https://www.ebkarco.ly:2096/
Can we make this with custom button?
thanks

1 Like

Hello friend, is this working on mobile, iPhone or Android device?