This.frm.call response to variable

Hi there,

I’m customizing a version of erpnext for my company and I have issue I need your help with it.

		var main_offer_items =  this.frm.call({
			method: "erpnext.controllers.queries.offer_query_main",
			args: {
				offer_name: offer,
			},
			callback: function(r) {
				if(r.message) {
					return r.message;
				};
			},
		});

How can I get the response from “r.message” to put it in a variable.

I hope someone could help me.

Thanks.

Try this:

var me = this;
var main_offer_items =  frappe.call({
  method: "erpnext.controllers.queries.offer_query_main",
  args: {
    offer_name: offer,
  },
  callback: function(r) {
    if(r.message) {
      me.frm.set_value("offer_rate", r.message);
    };
  },
});
2 Likes

what’s ‘offer_rate’ in this line

  me.frm.set_value("offer_rate", r.message);

I guess, your custom field?

Didn’t work.

I think I’m putting it in wrong place

you can look at code here :

I got to do it using this way

     cur_frm.fields_dict.offer_html

where ‘offer_html’ is my custom field

you can find the edit here :