Extracting username part from an email address | XM Community
Skip to main content

From email address in format "Username@@mylaurier.ca", I need to extract "Username" and pipe it into "Reply-To Email" as ${e://Field/myUserName}.
So basically, my Java script has take "Username@@mylaurier.ca" and delete the part "@mylaurier.ca" and write "Username" into ${e://Field/myUserName}.
My JS code is:
var EmailAdr= "${q://QID13/ChoiceTextEntryValue}";
var UserNameTemp = EmailAdr.match(/^(@mylaurier.ca)@/)[1];
Qualtrics.SurveyEngine.setEmbeddedData("myUserName", UserNameTemp);
The above code is not working. ${e://Field/myUserName} returns empty string.
I suspect a problem with EmailAdr.match(/^(@mylaurier.ca)@/)[1];

The task is motivated by unwelcomed transition from deprecated triggered Email to "Tasks" , where "Reply-To Email" will be set as concatenation of ${e://Field/myUserName} and "@mylaurier.ca" as discussed https://www.qualtrics.com/community/discussion/9980/upcoming-deprecation-of-new-survey-triggers-june-30th

Try:
var splitEmail = "${q://QID13/ChoiceTextEntryValue}".split("@");
Qualtrics.SurveyEngine.setEmbeddedData("myUserName", splitEmail[0]);


Actually, I tried
var UserNameTemp  =EmailAdr.substring(0, EmailAdr.lastIndexOf("@"));
Qualtrics.SurveyEngine.setEmbeddedData("myUserName", UserNameTemp);

and ${e://Field/myUserName} does return the username as I wanted.
But now there is another problem. It seems ${e://Field/myUserName} is not properly piped into "Reply-To Email:". See attached image
Capture.PNGWhen the received email is clicked on Reply-to, the expected reply email address is not there. "Reply-to" worked seamlessly in the deprecated triggered email, but is not working is Actions> Tasks as shown above.
I also tried to pipe with quotation marks "${e://Field/myUserName}", but no good.
What's wrong? Or how otherwise to pipe into "Reply-To Email:"?


Contact Qualtrics Support.


I contacted the support. They say that piping into "Reply-To Email:" is not supported in "Actions"


It's absolutely unacceptable!


HI Alex_WLU, if you haven't already, please consider posting this functionality as a Product Idea on Community! 🙂


Leave a Reply