Add button with custom jscript for PBX Integration

Hi folks,

I am making my first steps with jscript and erpnext and I would like to execute a simple get call when clicking a button.

I need to populate following URL parts of the get inserted below:
{userphonenumber} with the phonenumber stored in the users account
{phone_number} with a current doc form field

Thank you very much!

frappe.ui.form.on("Supplier", {
refresh: function(frm) {
// use the __islocal value of doc, to check if the doc is saved or not
frm.add_custom_button("Call Supplier", function() {
        $.get(
            "https://api.voverc.com/api/v2/temp/c2c/{token}/{userphonenumber}/{phone_number}",
        );
}, "Call Supplier")
}});

@Fabian_Thobe Go a Supplier Form page , on the browser open the debug tools,
In the console write: cur_frm.doc and you see the list of fields availiable.
So you can call them inside the script like: frm.doc.<field_name>

I like sure that you will not like my answer :stuck_out_tongue: , but its a start.

Also if you want to add custom fields (i assume for the token) , search Customize Form .

ping me to help you more this your issue :slight_smile: