Skip to main content
Bradley Hoyle (BizCover) 님이 #Apex에 질문했습니다
I have cases in SF which we use to manage claims. I store the claim number eg. 123456789 on the case in a custom field.

What we are doing is creating a custom inbound email handler to try and assess incoming emails and find the correct case to assign them to. Is there any way to take a email subject and search the claim numbers i have in the subject, If it contains a claim number we should put the email onto that case.

Ie

Case: 009873

Claim Number: 123456789

Incoming email subject: "New Claim - More Information Needed Claim 123456789"

We would find the claim number in the subject and therefore match the email to the case.

Is there a way to do this search on subjects through an inbound email handler?
답변 2개
  1. 2018년 8월 4일 오전 3:49
    Brad, You can use the Pattern and Matcher classes to match against a regular expression to find your claim number inside the subject field.  The following will return the first 9-digit number found in the 'subject' input string (or null, if no 9-digit number is found):

    <pre>

    String claimNumber = Pattern.compile('(\\d{9})').matcher(subject).group(1);

    </pre>
0/9000