ERPNext Foundation ERPNext Cloud Chat Blog Discuss Frappé* Donate

Realtime Data for changing a field

custom_script

#1

I am having a select-type field category and I want data from another doctype on change of this field.

This is what I have tried so far

cur_frm.cscript.category=function(frm){
frappe.call({
'method': 'frappe.client.get_list',
	'args':{
        'doctype': 'Morning Updates',
        'fields': service,
	'filters': {'category':cur_frm.doc.category}
	  },
        async: false,  
        callback: function(r)
	{
           console.log(r.message)
	}
	});

}

For first time it is giving the list, but let say I accidently selected another option and now want to select the right field, then for second time it is giving error.


#2

What is the error?


#3

expected stringtype or buffer


#4

Can you share the full trace? That will help the community help you faster.


#5

Just figured it out, I was having conflict in field name ambiguity.

Thanks btw @Rohan_Bansal


#6

Thanks for posting the answer :+1:


#7