Company and Person Tagging in Email In and Out communications

By | December 27, 2016

In this blog, we will be looking at a solution which will allow system to tag/link Company and Person against those email addresses which are not available in CRM. Let me explain this with an example.
Suppose, we have a Person associated with Greytrix Company in CRM which has 2 email addresses added against him. See below screenshot.
New StuffSage CRM Business Manager
IMG1
Now, CRM will automatically tag/link Company and Person; when we send any email to this person or receive emails from his registered email address. This linking can be seen on every communication list available against respective entities such as Cases, Opportunity, MY CRM , Team CRM etc.
Image2
 
image3
 
But, when this person send or receive any email communication on a new email address which is not available in CRM then system by default will only create a communication record in CRM. Here, in such communications Company and Person linking will not be available. This becomes difficult for users to identify the correct email. See below screenshot.
image4
To simplify this, we have created a trigger which will resolve this problem and display the proper linking.   Below is the trigger for your reference.
ALTER trigger [dbo].[UpdateCommLink] on [dbo].[Comm_Link]
after insert
as
Declare @Commid int
Declare @Flag int
Declare @Action varchar(100)
Declare @Opportunityid int
Declare @CaseID int
Declare @Companyid int
Declare @Personid int
Declare @CMLiCommID int
select @CMLiCommID=CmLi_Comm_CommunicationId from inserted
select @Commid=Comm_CommunicationId,@Opportunityid=Comm_OpportunityId,@CaseID=Comm_CaseId ,@Action=Comm_Action FROM Communication where Comm_CommunicationId=@CMLiCommID
if(@Action=’EmailOut’ and @Opportunityid is not null)
begin
select @Companyid=Oppo_PrimaryCompanyId,@Personid=Oppo_PrimaryPersonId from Opportunity (nolock) where Oppo_Deleted is null and Oppo_OpportunityId=@Opportunityid
update Comm_Link set CmLi_Comm_CompanyId=@Companyid , CmLi_Comm_PersonId=@Personid where CmLi_Comm_CommunicationId=@Commid and CmLi_Comm_CompanyId is null and CmLi_Comm_PersonId is null
end
if(@Action=’EmailOut’ and @CaseID is not null)
begin
select @Companyid=Case_PrimaryCompanyId,@Personid=Case_PrimaryPersonId from Cases (nolock) where Case_Deleted is null and Case_CaseId=@CaseID
update Comm_Link set CmLi_Comm_CompanyId=@Companyid , CmLi_Comm_PersonId=@Personid where CmLi_Comm_CommunicationId=@Commid and CmLi_Comm_CompanyId is null and CmLi_Comm_PersonId is null
end
Hope this helps!
Also Read:
1.Print Icon on Email Summary Screen
2.How the Phone, Email and Address Types are maintained in Sage CRM?
3.Provision to filter Emails Only in CRM
4.Notify Task Creator with Email notification when Task is completed
5.How to control Email Forward and Reply Translations