Hi, I need a help how to get this assigned to email ids?
urgent kindly help me on this.
thank you.
Hi, I need a help how to get this assigned to email ids?
urgent kindly help me on this.
thank you.
client side or server side?
For Client Side
frappe.db.get_value("ToDo", {reference_type:"Doctype Name","reference_name":frm.doc.name}, "allocated_to").then(function(r) {
var assign_to = r.message.allocated_to;
Server Side
frappe.db.get_value("ToDo", {reference_type:"Doctype Name","reference_name":doc.name}, "allocated_to")
in console it’s showing has undefined.
It’s working sorry, I made small mistake.
Thank a lot.
But, this script unable to fetch multiple assigned email address, it getting only the first mail address. How to fetch all the email id.
Instead of get_value, use get_all
Okay, Thank you.
But it’s show a error:
Uncaught (in promise) TypeError: frappe.db.get_all is not a function
how to solve this one.
Hi, @mohitchechani
I have solve it using get_list
frappe.db.get_list("ToDo", {
filters: {
"reference_type": "Doc Name",
"reference_name": frm.doc.name
},
fields: ["allocated_to"]
}).then(function(results) {
if (results.length > 0) {
var email_ids = [];
results.forEach(function(result) {
var ids = result.allocated_to.split(",");
email_ids = email_ids.concat(ids);
});
console.log(email_ids);
}
});
Thanks a lot for your time and help.
@VINOTH @mohitchechani You can also try select query for the required doctype, all the assigned users are stored in db as a list for each record. select _assign from tabDoc name
where name=%s;
@arokia
Thanks for you implementation, Using the above code a example can, you kindly share the code on what you have explained.
Thank you.
frappe.db.sql(select _assign from tabDoc name
where name=%s);
This query will return the email is of users assigned to each record.
_assign is a list field in db, it captures multiple users email id.
thank you.