You need to sign in to do that
Don't have an account?
How to assign the subject of a task to the email subject line
We have a trigger that creates a task for inbound email replies to existing cases. Currently, the task that is created has a subject line something like "An email reply has been received". This is stored as a system label.
Instead, I want the code to assign the subject line of the email to the task subject.
Any idea how I get the emails subject line, to replace the code seen below?
All help greatly appreciated.
for (Integer i : emailIds) {
if(((String)cases.get(trigger.new[i].ParentId).ownerid).startsWith('005')) { // no tasks for cases that are still assigned to a queue, only users
Task t = new Task(Subject = System.label.Custom_Case_Email_Task_Subject,
whatid = trigger.new[i].parentId,
activitydate = Date.today()
);
// Assign task to the Level 1 Case Owner Id if it exists
if(cases.get(trigger.new[i].parentid).Level1_Case_Owner_Id__c == null) {
t.ownerid = cases.get(trigger.new[i].parentid).ownerid;
} else {
t.ownerid = cases.get(trigger.new[i].parentid).Level1_Case_Owner_Id__c;
}
emailMsgsWithTasks.add(i); // note that this email has associated task, to update below.
tasks.add(t);
}
}
as you said you are using inbound email services concept there you have a property to get the subject like email.subject. where email is the object for the Messaging.inboundEmail..
example code:
All Answers
as you said you are using inbound email services concept there you have a property to get the subject like email.subject. where email is the object for the Messaging.inboundEmail..
example code:
Thanks Kiran. That helps.
I'm new to Apex and triggers....do you know what is the link to find a list of all objects and their properties/methods?
Chris