I have written apex trigger codes on both Case and EmailMessage objects, which are both fired by before insert events. They run pattern and matcher classes to block several possible formats of a credit card number.
The problem is that, when a case is created by standard Email2Case functionality of Salesforce, I am able to view the unblocked credit card number in feed post generated by the email itself. See screenshots below:
Credit card number is blocked in above picture and replaced by "K.KART_NO". However, when I expand this feed post, I am able to view the unblocked number.
This credit card number is blocked in everywhere else - case subject, case description, emailmessage subject and emailmessage body.
Does anyone have a logical / technical explanation for this occurrence, and maybe a solution for it?
Thanks in advance.
After adding the FeedItem trigger suggested by
crmprogdev the problem is not resolved. Problem still persists in the same way. See the new feed post below (when it is collapsed, blocked version displays as shown in above picture):
I used workbench tool to query the faulty FeedItem and check all its details. See the screenshot below:
I was expecting the body to host the text with unblocked number, but it is empty. No field includes this value, which is a bit odd for me. What could it possibly reference to?
I queried the EmailMessage object, and saw that I have skipped the HtmlBody field. I updated my EmailMessage trigger to also check and block HtmlBody, and, it worked!