pm = CreateObject("Component", "Menu");
myArgument = 'communicationlist';
pm.MenuFunction(myArgument,#getP.Patient_Id#,'','','','');
SELECT Communication.Comm_ID, Communication.CommSub_ID, Communication.Comm_Date, Communication.Resolved,
Communication.Record_Created_By ,CommunicationSubjects.CommSub_ID, CommunicationSubjects.Subject ,
ct.employee_id, pEmployee.Emp_ID , pEmployee.Emp_First ,pEmployee.Emp_Last
FROM #Request.prefix_db_agency#.Communication
JOIN #Request.prefix_db_agency#.CommunicationSubjects ON CommunicationSubjects.CommSub_ID = Communication.CommSub_ID
LEFT OUTER JOIN #Request.prefix_db_agency#.communication_to ct ON Communication.Comm_ID = ct.comm_id
LEFT OUTER JOIN #Request.prefix_db_lookup#.pEmployee ON pEmployee.Emp_ID = Communication.Record_Created_By
WHERE Communication.Patient_ID = #session.cs.patientid#
AND Communication.Agency_ID = #session.AgencyID#
AND Communication.Comm_record_deleted <> 1
AND Communication.Status = 0
GROUP BY Communication.Comm_ID
Order by Comm_Date Desc