Best answer

make fields anonimous

  • 7 November 2020
  • 3 replies
  • 46 views

I need to make personal information anonimous but still allow for a small preview of the data.

 

For example an email address needs to be converted into saXXXXXXXer@gmXXX.Xom

Or a phone number into 06XXXXXX12

Etc

How can I set this up?

 

icon

Best answer by andywingrave 7 November 2020, 15:58

View original

This post has been closed for comments. Please create a new post if you need help or have a question about this topic.

3 replies

Userlevel 7
Badge +14

Regex (https://www.w3schools.com/jsref/jsref_obj_regexp.asp) in a Code step: https://zapier.com/apps/code/help

Userlevel 7
Badge +9

Hello! I’m not sure this can be completed without a code step..

This will do it in a JavaScript code step (some of the clumsiest code I’ve written...But gets the job done...)

function replaceRange(s, start, end, substitute) {
return s.substring(0, start) + substitute + s.substring(end);
}

let email = inputData.email
let phone = inputData.phone
let emailStart = Math.round(email.length/4)
let emailEnd = emailStart*3
let phoneStart = Math.round(phone.length/4)
let phoneEnd = phoneStart*3

let newEmail = replaceRange(email, emailStart, emailEnd, "XXXXXX");
let newphone = replaceRange(phone, phoneStart, phoneEnd, "XXXXXX");

output = [{newphone, newEmail}];

 

Userlevel 7
Badge +8

Hi @Sander , did we answer your question in this topic? Please let us know by marking Best answer if so. If not, let us know by replying back to this topic.

Thank you!