You need to sign in to do that
Don't have an account?
Gabe Sanchez 7
Parse email and capture text from body
I am trying to capture a portion of the body of an email from a certain client in salesforce. Basically, the body will also have "ref:20392039". I want to capture that and drop it into our field in SF called Service Now Ref Code. Any ideas on how to do this?
Please try the below code
Hope it helps. If it solves your problem please mark this as the best solution.
Thanks and Regards
Ayush Sharma
Use this Logic in you Apex code when you are updating the field in Apex Trigger/Batch.
RefCode is the field where you put value from email Body.
Thanks
Ayush
I assume I have to create that and then insert it here, correct?
Thanks again for the help!!
Please provide me the following:
1. Is the Body field on the Object you are creating Process builder on. If yes then Provide me the API name of Object.
2. Provide me the API name of fields => 1. Which contains the ref: Id 2. Where you want to insert RFID.
3. If case 1 is false then tell me the relation between objects.
Please let me know above, so I can create a sample code.
Regards
Ayush
1. I am using 'Email Message in process builder, then matching criteria since it is only 1 client that we need this for.
[EmailMessage].fromAddress
[EmailMessage].subject
2. API for the field I need is :
ServiceNow_Ref_Code__c
This is on the object of the case.
Please let me know if I've answered your questions.
Please try below solution
Create a class with this code:
And your Process builder Action should look like https://ibb.co/sCmXR60.
Let me know if any error arises.
Regards
Ayush
I finally did get this into prod, but it did not update the ref code. I also realized that sample Ref codes were like these vs 1234567 :
Ref:MSG38602367
Ref:MSG38689603
Would the process still work? Also in the process builder, I should be using EmailMessage as an object correct? I did get an error when I put the ref in SF in the description.
Ref:38810719 <javascript:void(0);>
That is the sample that I used.
Thanks again for the help!
Gabe
I finally did get this into prod, but it did not update the ref code. I also realized that sample Ref codes were like these vs 1234567 :
Ref:MSG38602367
Ref:MSG38689603
Would the process still work? Also in the process builder, I should be using EmailMessage as an object correct? I did get an error when I put the ref in SF in the description.
Ref:38810719 <javascript:void(0);>
That is the sample that I used.
Thanks again for the help!
Gabe