fix: Last communication query
diff --git a/erpnext/communication/doctype/call_log/call_log.json b/erpnext/communication/doctype/call_log/call_log.json
index 43da3b3..508ade9 100644
--- a/erpnext/communication/doctype/call_log/call_log.json
+++ b/erpnext/communication/doctype/call_log/call_log.json
@@ -145,13 +145,8 @@
    "write": 1
   },
   {
-   "email": 1,
-   "export": 1,
-   "print": 1,
    "read": 1,
-   "report": 1,
-   "role": "Employee",
-   "share": 1
+   "role": "Employee"
   }
  ],
  "sort_field": "modified",
diff --git a/erpnext/crm/doctype/utils.py b/erpnext/crm/doctype/utils.py
index 0cd2557..7e9a8f4 100644
--- a/erpnext/crm/doctype/utils.py
+++ b/erpnext/crm/doctype/utils.py
@@ -20,7 +20,7 @@
 		if query_condition:
 			# remove extra appended 'OR'
 			query_condition = query_condition[:-2]
-			communication = frappe.db.sql("""
+			last_communication = frappe.db.sql("""
 				SELECT `name`, `content`
 				FROM `tabCommunication`
 				WHERE
@@ -28,12 +28,12 @@
 					({})
 				ORDER BY `modified`
 				LIMIT 1
-			""".format(query_condition))  # nosec
+			""".format(query_condition), as_dict=1)  # nosec
 
 	if lead:
 		last_communication = frappe.get_all('Communication', filters={
-			'reference_doctype': reference_doc.doctype,
-			'reference_name': reference_doc.name,
+			'reference_doctype': 'Contact',
+			'reference_name': contact,
 			'sent_or_received': 'Received'
 		}, fields=['name', 'content'], limit=1)