Try ERPNext Buy Support Partners Foundation

Help with custom script

Hi Guys ,

I read this post and got the below script and that works like a charm , but I have a issue

{
frappe.ui.form.on("VAVE", "refresh", function(frm,doc) {
    cur_frm.set_query("treatment", function() {
return {
            "filters": {
                "item1": cur_frm.doc.job_order,  
                         }
       };
});});
}

My data job_order will be there in item1 field or it might be in item2 field ,also it could be in item3 field , so I want those docs which contain the job_order I entered in my doc to be visible in the link field . If I add one more line in the filter like this

“filters”: {
“item1”: cur_frm.doc.job_order,
“item2”: cur_frm.doc.job_order,
}

only those docs which contains the entered job_order in both the above fields are getting displayed.

Any help would be a life saver .

Thanks in advance

Edit :

To put it simply , rather than searching the data in a particular field in a doc , all the fields in the doc has to be searched for my data .

Please help

Any help guys ?

Thanks

Please could anyone guide me ?

Thanks

Please state clearly and briefly, what have you tried and what is your problem. Remember that no one has your local setup to test.

@rmehta

Hi sir,

I look to implement Custom script on Start date to create event in Calendar.

Please can you tell me how.

If I’ve understood you correctly, you would like to search for the same value in multiple fields. To achieve this, you can use or_filters

To expand on your example,

frappe.ui.form.on("VAVE", "refresh", function (frm, doc) {
	cur_frm.set_query("treatment", function () {
		return {
			"or_filters": {
				"item1": cur_frm.doc.job_order,
				"item2": cur_frm.doc.job_order,
				"item3": cur_frm.doc.job_order,
			}
		};
	});
});