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

Fetch customer phone on Payment Entry form


#1

I want to fetch the customer phone number automatically when we select party type “customer” and select the party name.


#2

You could add a Custom Script similar to this one:

frappe.ui.form.on('Payment Entry', {
    party_type: function(frm) {
        /* when party_type field is changed */
        if (frm.doc.party_type === 'Customer') {
            /* if party_type is 'Customer', fetch the field 'mobile_no' of 
            the customer selected in 'party_name' and write it into the 
            current form's field 'party_phone' */
            add_fetch('party_name', 'mobile_no', 'party_phone');
        }
    },
});