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
SayasoniSayasoni 

Unresolved Items

Which kind of object is MyUnresolved Items?. I have a custom object called Candidates__c which has Main_Email__c as one of the fields, the problem is that when a Salesforce user(User with an account in salesforce) receives an email from a Candidate and the Salesforce user autoforwards the Email to salesforce using the Email to Salesforce generated url, the email is saved under the Unresolved Items, Is it possible to automatically assign the email to the specific custom object 'Candidates__c', lets say using a trigger which gets fired on 'after insert'. Anyone with an idea on how to go about this?!!

Navatar_DbSupNavatar_DbSup

Hi,


You can use the InboundEmail process. You can save the content in any object.


Use the below code snippet as reference:


class CreateTaskEmailExample implements Messaging.InboundEmailHandler {

global Messaging.InboundEmailResult handleInboundEmail(Messaging.inboundEmail email,
Messaging.InboundEnvelope env){

// Create an InboundEmailResult object for returning the result of the

// Apex Email Service

Messaging.InboundEmailResult result = new Messaging.InboundEmailResult();

String myPlainText= '';

// Add the email plain text into the local variable

myPlainText = email.plainTextBody;

// New Task object to be created

Task[] newTask = new Task[0];

// Try to look up any contacts based on the email from address

// If there is more than one contact with the same email address,

// an exception will be thrown and the catch statement will be called.

try {
Contact vCon = [SELECT Id, Name, Email
FROM Contact
WHERE Email = :email.fromAddress
LIMIT 1];

// Add a new Task to the contact record we just found above.

newTask.add(new Task(Description = myPlainText,
Priority = 'Normal',
Status = 'Inbound Email',
Subject = email.subject,
IsReminderSet = true,
ReminderDateTime = System.now()+1,
WhoId = vCon.Id));

// Insert the new Task

insert newTask;

System.debug('New Task Object: ' + newTask );
}
// If an exception occurs when the query accesses

// the contact record, a QueryException is called.

// The exception is written to the Apex debug log.

catch (QueryException e) {
System.debug('Query Issue: ' + e);
}

// Set the result to true. No need to send an email back to the user

// with an error message

result.success = true;

// Return the result for the Apex Email Service

return result;
}
}

 

 Did this answer your question? If not, let me know what didn't work, or if so, please mark it solved. 

SayasoniSayasoni

Hi,

Thank you S Jain,  am able to log the inbound email to the specific object, my question is, someone send and email to a salesforce user. This user intern has a filter that forward all emails that come in to the email that salsforce generated. When the email get's to salesforce the 'from field' has the salesforce users email address. How can we get the original send's email address? Will use it to query the custom object.

Thanks.

SayasoniSayasoni

I found out a solution on how to go around the above problem, glad that it's over.

Thanks.

wylieatworknzwylieatworknz

Hi there - I have a similar question in that I am trying to find out more about the nature of unresolved items so that I can possibly 'resolve' a group en masse using the data loader.  Can you tell me please what your workaround was or if you found out any more about unresolved items so that I can see if it could help us too :)

Many thanks

Susan

Andee Weir 17Andee Weir 17
Likewise.  Anyone know how to do this?