function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
sp13sp13 

Trigger - How to get a number in a rich text field

I have a RichTextField__c that contains text like below:

Dear FirstName,

Please see below for details:
Total: $1000  
<--- I need to get the number "1000" and save it to another custom field. 
 

Thanks,
FirstName


Is there a way for me to get the total amount only "1000" and save it as the value of another custom field using a trigger?

Sumeet_ForceSumeet_Force

Yes...If you are sure that other text is going to be mostly the same...then you can use some string functions smartly and get the value of 1000 easily. 1 of Quick ways to do:

1. Read entire string into variable.

2. find position of ONLY keyword and after AND keyword and remove all text before and after that.
3. This will keep just the 1000 there and then you can push it to the custom field.