Skip to main content
Best answer

make fields anonimous

  • November 7, 2020
  • 3 replies
  • 63 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?

 

Best answer by andywingrave

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}];

 

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

Troy Tessalone
Zapier Orchestrator & Solution Partner
Forum|alt.badge.img+14
  • Zapier Orchestrator & Solution Partner
  • 34043 replies
  • November 7, 2020

andywingrave
Forum|alt.badge.img+9
  • Zapier Solution Partner
  • 854 replies
  • Answer
  • November 7, 2020

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}];

 


steph.n
Forum|alt.badge.img+8
  • Builder
  • 899 replies
  • November 10, 2020

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!