update an embedded data field email domain via JS? | XM Community
Skip to main content

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.

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.


Beautiful, thank you ahmedA worked perfectly!


Leave a Reply