Fetch customer phone on Payment Entry form

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

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');
        }
    },
});
1 Like

how to add the above along with my code for payment entry to give output of 3 field based on paid amount

frappe.ui.form.on('Payment Entry', {
    refresh(frm) {
        function compute(doc, cdt, cdn) {
            {
                if (doc.payment_type == "Receive")//it’s check if the fields contains a value
                    doc.gst_ledger_amount = Math.ceil(parseFloat(doc.paid_amount)) - Math.ceil(parseFloat(doc.paid_amount) / 1.25);
                doc.incentive_amount = Math.ceil(parseFloat(doc.paid_amount) * 0.02);
                doc.ttmd_amount = Math.ceil(parseFloat(doc.paid_amount) * 0.01);
            }
        }
        cur_frm.cscript.custom_paid_amount = compute;
        cur_frm.cscript.custom_mode_of_payment = compute; // your code here
    }
});

@Muhammad_Ashfaq sir did you solve this one…i am facing the same query and i am trying for that using custom script but the value is not get fetched…
help me in that if you solve earlier.

Thanks In Advance

cur_frm.add_fetch(‘delivery_contact_name’, ‘mobile_no’, ‘delivery_contact_phone’);

cur_frm.add_fetch(‘source link field name’, ‘coresponding field name in that doctype’, ‘destination field where data to be shown’);