ERPNext Foundation ERPNext Cloud User Manual Blog Discuss Frappé* Donate

Global variables on client side script


#1

I want to declaire some variables on client side, how can I do t hat?

e.g:

frappe.ui.form.on('Sales Order', {

const status = {
    EXTERNA: 'Externa',
};
let externa = status.EXTERNA;

refresh: function (frm) {
    console.log(externa);
}

});


#2

@Leonardo_Augusto
You can declare variables in the sales_order.js file and use it appropriately

 frappe.ui.form.on('Sales Order','onload', function(frm, cdt, cdn) {
     var payment_value=0;
    payment_value=cur_frm.doc.payment_value;
    });

Refer this link for further information https://github.com/frappe/frappe/wiki/Developer-Cheatsheet

I hope you find this useful.