function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
LakshmanLakshman 

Apex trigger to assign incoming message to a predefined case team member

Hi All,

 

Need help in writing an Apex trigger to assign incoming message from some address say abc@abc.com to a predefined case team member say MyTeam which has one member. How can we do this?

Please help me on this.

Thank you!

 

Regards,

Lakshman

Best Answer chosen by Admin (Salesforce Developers) 
LakshmanLakshman

Ryan,

 

I did that using trigger and inserted record in CaseTeamTemplateRecord for my conditions by just specifying two items :TeamTemplateId, ParentId in it.

It seems to be working now.

 

Regards,

Lakshman

All Answers

spraetzspraetz

You'll want to write an inbound email handler.  There's a good examle in the docs.

LakshmanLakshman

Ryan,

 

I did that using trigger and inserted record in CaseTeamTemplateRecord for my conditions by just specifying two items :TeamTemplateId, ParentId in it.

It seems to be working now.

 

Regards,

Lakshman

This was selected as the best answer
shruthikashruthika

Hi Lakshman,

 

 

Am very much new in Salesforce. Could you please provide the piece of code which u tried in assigning the Cases.

 

I have the same task. Please provide me the solution as soon as possible.

 

 

 

Thanks in Advance,

Shruthika

LakshmanLakshman

Hey Shrutika,

 

Sorry for late response was on vacations. Below is what I did in the trigger:

trigger TriggerOnEmailMessage on EmailMessage(after insert)

{

CaseTeamTemplate ctt = [Select Id From CaseTeamTemplate c where Name = ' case team template name' limit 1];

for(EmailMessage em :trigger.new)

{

CaseTeamTemplateRecord cttr = new CaseTeamTemplateRecord(TeamTemplateId = ctt.Id, ParentId = em.ParentId);
upsert cttr;

}

}

 

Let me know if you have already solved it.

 

Regards,

Lakshman