update an embedded data field email domain via JS? | XM Community
Solved

update an embedded data field email domain via JS?

  • 3 December 2020
  • 2 replies
  • 29 views

Userlevel 2
Badge +3

Hi,
I am looking for a way to take an embedded data field that contains an email address ie "john . doe @ abc.com" and replace the @abc.com with @xyz and write that back to the same embedded data field.
Can this be done with JS in the survey? Any idea how?
*didnt mean to put this question in 'Best Practices" Please move if needed.

icon

Best answer by ahmedA 3 December 2020, 23:38

View original

2 replies

Userlevel 7
Badge +21

old_email = "${e://Field/email}";
old_email = old_email.split("@");
new_email = old_email[0] + "@xyz";
Qualtrics.SurveyEngine.setEmbeddedData("email", new_email);
This should do the trick for you.

Userlevel 2
Badge +3

Beautiful, thank you ahmedA worked perfectly!

Leave a Reply