When selecting a template in the prompt, the template content is not fetched in the message box

Hi

I have created a custom doctype in CRM module - WhatsApp Messages Template, consisting of two fields - subject (data) and message_box (text).

Also , i have created a custom button (whatsapp message) on Lead doctype, which fetches the lead mobile no and the message from message_box and send it via whatsapp web.

The problem i am facing is - When selecting a template in the prompt, the template content is not fetched in the message box.

following is the code -

frappe.ui.form.on(“Lead”, “refresh”, function(frm){
frm.add_custom_button(“WhatsApp”, function(){

            if(!frm.doc.whatsapp_mobile_no)
            {
                frappe.msgprint(__("Please Update WhatsApp Number First."));
                return false;
            }
        
            frappe.prompt([
            {'fieldtype': 'Link', 'label': 'WhatsApp Messages Template','fieldname':'whatsapp_messages_template', 'options':'WhatsApp Messages Template'},
            {'fieldtype': 'Text','label': 'Message Box','fieldname': 'message_box'}
            ],
            function(values){
                
            var whatsappno = frm.doc.country_code + frm.doc.whatsapp_mobile_no
            var msg = values.message_box
            var myWin = window.open('https://api.whatsapp.com/send?phone='+ whatsappno+'&text='+ msg);
            })
            
                
});

});