0

if case parentid and incoming email parentld same then store the email on its related list

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

    List<Case> cs = [SELECT Id, parentId FROM case WHERE parentld =: **** LIMIT 1]; 

what i put at where clause if parentid and incoming email has same parentid should i use Messaging.InboundEmail email or Messaging.InboundEnvelope envelope and how

0

You are doing the right thing : -

// Apex Email Service
    Messaging.InboundEmailResult result = new Messaging.InboundEmailResult();

now based on your incoming email you need take the parent id , say if the id is in subject then you can find it in,

String strSubject = email.subject;

if the id is in body then you can find it in,

String myPlainText = email.plainTextBody;

from those strings you need to find out the ParentId then you can use it in your own query.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.