Yes, you are getting the all cmomunications from Leads not the latest communication from current lead, add a new condition in where:
WHERE con.parenttype = 'Lead' AND con.parent='%s'
and pass cur_frm.docname as paramenter to query
--
You received this message because you are subscribed to the Google Groups "ERPNext User's Forum" group.
To unsubscribe from this group and stop receiving emails from it, send an email to erpnext-user-fo...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/erpnext-user-forum/7b784768-da53-4092-8793-3b59424b940d%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Lead ID |
Communication ID |
Communication Date |
LEAD001 |
COM1 |
01-01-2010 |
LEAD001 |
COM2 |
29-03-2014 |
LEAD002 |
COM3 |
01-01-2010 |
LEAD002 |
COM4 |
29-03-2014 |
LEAD003 |
COM5 |
01-01-2010 |
LEAD003 |
COM6 |
29-03-2014 |
Lead ID |
Communication ID |
Communication Date |
LEAD001 |
COM2 |
29-03-2014 |
LEAD002 |
COM4 |
29-03-2014 |
LEAD003 |
COM6 |
29-03-2014 |
Lead ID |
Communication ID |
Communication Date |
LEAD001 |
COM1 |
29-03-2014 |
LEAD002 |
COM3 |
29-03-2014 |
LEAD003 |
COM5 |
29-03-2014 |
Yes, you are getting the all cmomunications from Leads not the latest communication from current lead, add a new condition in where:
WHERE con.parenttype = 'Lead' AND con.parent='%s'
and pass cur_frm.docname as paramenter to query
2014-03-28 8:25 GMT-03:00 Addy <aditya...@gmail.com>:
Hi,This is driving me nuts, I have been trying to get the latest communication for a lead and this is the code I am using but the problem is that the communication ID shown in the output is old whereas the date shown in the list is of the latest communication, I have used a similar code in Sales Orders but there I am getting the correct results, is there something wrong with my code or something else.SELECT com.parent, com.name, max(com.communication_date)FROM `tabCommunication` comWHERE com.parenttype = 'Lead'GROUP BY com.parentPlease note that the com.name column is always showing the most earliest id of the communication instead of the latest.
--
You received this message because you are subscribed to the Google Groups "ERPNext User's Forum" group.
To unsubscribe from this group and stop receiving emails from it, send an email to erpnext-user-forum+unsub...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/erpnext-user-forum/7b784768-da53-4092-8793-3b59424b940d%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
To unsubscribe from this group and stop receiving emails from it, send an email to erpnext-user-fo...@googlegroups.com.To view this discussion on the web visit https://groups.google.com/d/msgid/erpnext-user-forum/a02f3751-835b-4d5f-b307-fa9c19bbde05%40googlegroups.com.
To unsubscribe from this group and stop receiving emails from it, send an email to erpnext-user-forum+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/erpnext-user-forum/7b784768-da53-4092-8793-3b59424b940d%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
--
You received this message because you are subscribed to the Google Groups "ERPNext User's Forum" group.
To unsubscribe from this group and stop receiving emails from it, send an email to erpnext-user-forum+unsub...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/erpnext-user-forum/a02f3751-835b-4d5f-b307-fa9c19bbde05%40googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/erpnext-user-forum/a793c2c9-e979-4689-a355-b59378c954ae%40googlegroups.com.To unsubscribe from this group and stop receiving emails from it, send an email to erpnext-user-fo...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/erpnext-user-forum/a02f3751-835b-4d5f-b307-fa9c19bbde05%40googlegroups.com.
--
You received this message because you are subscribed to the Google Groups "ERPNext User's Forum" group.
To unsubscribe from this group and stop receiving emails from it, send an email to erpnext-user-forum+unsub...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/erpnext-user-forum/a793c2c9-e979-4689-a355-b59378c954ae%40googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/erpnext-user-forum/ce04f5f2-23d2-47e0-9a7f-b9e7ba56dde9%40googlegroups.com.To unsubscribe from this group and stop receiving emails from it, send an email to erpnext-user-fo...@googlegroups.com.