You need to sign in to do that
Don't have an account?
Sathish Loganathan
How to remove entire Text after hyphen from a TexBody (EmailMessage field)
Hi,
Help needed in removing the text which is present after hyphen(--) from a TexBody (EmailMessage field). So my request is to copy only the new Email to case comment.
for Example:
Hello,
This is an example.
--- Original Message--
Previous Email Threads
Copy only "Hello,
This is an example." to the case comment field.
Kindly please let me know a possible solution to acheive this.
Thanks in Advance.
Regards,
Sathish
Help needed in removing the text which is present after hyphen(--) from a TexBody (EmailMessage field). So my request is to copy only the new Email to case comment.
for Example:
Hello,
This is an example.
--- Original Message--
Previous Email Threads
Copy only "Hello,
This is an example." to the case comment field.
Kindly please let me know a possible solution to acheive this.
Thanks in Advance.
Regards,
Sathish
Just use STRING FUNCTIONS in apex. BElow solution should work (have not tried though)
1. put the message in String variable
2. use IndexOf String function which will give you first occurence of hyphen
3. use SubsTring function
here is the documentation-
https://developer.salesforce.com/docs/atlas.en-us.apexcode.meta/apexcode/apex_methods_system_string.htm
All Answers
Just use STRING FUNCTIONS in apex. BElow solution should work (have not tried though)
1. put the message in String variable
2. use IndexOf String function which will give you first occurence of hyphen
3. use SubsTring function
here is the documentation-
https://developer.salesforce.com/docs/atlas.en-us.apexcode.meta/apexcode/apex_methods_system_string.htm