Hi @WarrenBelz ,
I will try and explain the whole picture 🙂
The function for the app is to store and track notes and progress in a new sales leads and its on-boarding process. According to laws in EU (GDPR) information such as e-mail, phone number and similar information that could identify a person is consider sensitive. The law states that this kind of information isn't allowed to store longer than necessary. Hence the information must be traceable and erasable or able to be anonymized.
So when the user inputs information and notes into the app a series of RegEx searches are made on the text, text that matches "sensitive data" gets marked and the actual words copies and stores in same record as the actual note.
When the user saves the information a record with the notes and marked keywords (matched as sensitive information) will be saved in a table. Both fields are text fields, NotesHtmlText and GDPRContent
The record looks like this:

Now to the tricky part. When the on-boarding are finished or the lead is terminated and appropriate time has past the data should be either anonymized or erased. I'm trying to anonymize the data.
So back to the question:
varGdprLeadsNote is the selected record in the "LeadNotesTable" that i want to anonymize.
varGdprLeadsNote.NotesHtmlText is the field that contains the actual note/information submitted by the user.
VarGdprLeadsNote.GDPRContent is the field that contains identified sensitive "words", mail phone number etc inside the submitted note/information. The "keywords" are stored as a string separated with ";".
So the thing I'm trying to do is to replace NotesHtmlText with a new string where all of the keywords in GDPRContent are replaced with "****".
However this formula only takes me halfway. The NotesHtmlText remains unchanged which I now understand is expected.
ForAll(
//Creates a collection to loop throu with the keywords to anonymize, by parsing the
//comma separeted string stored in the 'GDPRContent' field.
Split(varGdprLeadsNote.GDPRContent;";");
//Replaces the keywords in the submited text.
Substitute(varGdprLeadsNote.NotesHtmlText; ThisRecord.Result; "****")
)
If i put the result from the ForAll into a collection I end up with a new collection containing each result from the loop:

The result i want to write back should look like this:
<p>Bl bla **** med mer</p><p>Bla **** etc och så vidare</p>
As I said before any input are greatly appreciated!