Fetching Data into Dialog Box field

Hi,
Use Case

  1. I have create a dialog box.
  2. Given one field as options type in which i can store mobile numbers from lead doctype.
  3. Mobile number would be defining in 2 different field one is Primary & second is Secondary.

What I suffering ?
I am not able to fetching both mobile number.

Below are the Scripts ?

frappe.ui.form.on("Lead", "refresh", function(frm){
// add button fuction
frm.add_custom_button("Send SMS", function(click){
var mobile_number_list=[];
var number_list=[];
var mobile=cur_frm.doc.mobile_number;
// function to fetch only from current document
frappe.call({
                method: 'frappe.client.get_list',
                args:
                {
                    'doctype': 'Lead',
                    'fields': ['mobile_number','phone_number'],
		filters:
        	{
          name:frm.doc.name,
	       	}               
		},
                async: false,
                callback: function( r)
                {
                   number_list= r.message;
		console.log(number_list);
		console.log(number_list.length);
		for(var i = 0; i <= number_list.length; i++) {
	  	 mobile_number_list[i]= number_list[i].mobile_number;
		}
			}
   
            });
// Function to show dialog box
var d = new frappe.ui.Dialog({
    'fields': [
        {"fieldtype": "Select", "label": "Mobile Number" , "fieldname": "mobile_number","options":mobile_number_list},
       
    ],
    primary_action: function(){
        d.hide();
        show_alert(d.get_values());
    }
});

d.show();

});
});
1 Like

Please Help!

don’t worry ! I solved it.

callback: function® {

    number_list = r.message;
    var options = number_list[0];
    arr = Array.from(Object.keys(options), k => options[k]);
    
  }
});