You need to sign in to do that
Don't have an account?
Gabe Sanchez 7
Parsing email and capturing text from email body in SF
Hello,
Had some help from a community user but cant figure out how to get this to work. I am brand new to Apex. I am trying to parse an email message and insert it into a field in salesforce. II have created the class and here is the code :
Had some help from a community user but cant figure out how to get this to work. I am brand new to Apex. I am trying to parse an email message and insert it into a field in salesforce. II have created the class and here is the code :
public class InvocableMethods { 02 03 @InvocableMethod( label='Ger Ref Id' description='' category='Case' ) 04 public static void getRefId( List<EmailMessage> emailMsgList ){ 05 List<Case> casesToUpdate = new List<Case>(); 06 for( EmailMessage em : emailMsgList ){ 07 if( em.TextBody != null ){ 08 Matcher m = Pattern.compile('ref:+.......[0-9]').matcher(em.TextBody); 09 if( m.find() ){ 10 casesToUpdate.add( new Case( Id = em.RelatedToId, ServiceNow_Ref_Code__c = m.group() ) ); 11 } 12 } 13 } 14 update casesToUpdate; 15 } 16 17 }
I am trying to get "ref:123456789" from the body of the email and insert it into "ServiceNow_Ref_Code__c",
I have set up process builder and it looks like this :
Any ideas on what I am doing wrong here?
Thanks!
Gabe
Greetings!
Can you please find the sample code to capture the body of the email and insert into the field:
https://salesforce.stackexchange.com/questions/92138/email-body-text-capture-in-email-service
Kindly let me know if it helps you and close your query by marking it as solved so that it can help others in the future.
Warm Regards,
Shirisha Pathuri