You need to sign in to do that
Don't have an account?
Abdul Subahani BS 8
If Email Address dosent exist create a contact and then case
global class inboundEmail implements Messaging.InboundEmailHandler { global Messaging.InboundEmailResult handleInboundEmail(Messaging.InboundEmail email, Messaging.InboundEnvelope envelope) { Messaging.InboundEmailResult result = new Messaging.InboundEmailresult(); contact con =[SELECT Id,AccountId,Email,FirstName,LastName,Name FROM Contact WHERE email= :email.fromaddress LIMIT 1]; if(con != null){ case cs=new case(); cs.Status='New'; cs.Origin='Phone'; cs.contactid=con.id; cs.subject=email.subject; cs.description=email.plaintextbody; try{ insert cs; result.success=True; }catch(DMLException e){ system.debug('Following error occured'+e); result.success=false; } }else{ /*in place of a print message I would like to create a new contact or a case?*/ System.debug('contact dosent exist'); } return result; } }
Please use the list instead of contact.
Thanks,
Maharajan.C
All Answers
Kindly try the above.
If it helps, Kindly mark it as the best answer.
Regards,
Priya Ranjan
Please use the list instead of contact.
Thanks,
Maharajan.C