Hello, I have been attempting to remove the 13 characters on the left of an EmbeddedData field. I have found some resources and a somewhat similar example, but have not been having luck.
For this survey we wanted two links per potential respondent, with different features for our call team and the email/web version, so we upload them twice. Once with their email as written and once with PHONE.VERSION. in front of it. The issue is we want to pipe in their email address at the end so our call staff sees that and can confirm, without PHONE.VERSION in front of it.
What I am seeking to do is have ${e://Field/RecipientEmail} display as their email without “PHONE.VERSION” -- essentially removing the first 13 characters, if the embedded data field PhoneFlag=1. Here is the javascript I have been trying:
Qualtrics.SurveyEngine.addOnload(function() {
// Get the value of PhoneFlag
var phoneFlagValue = "${e://Field/PhoneFlag}";
// Check if PhoneFlag equals 1
if (phoneFlagValue === "1") {
// Get the email address of the respondent
var originalEmail = "${e://Field/RecipientEmail}";
// Remove the first 13 characters using substring
var modifiedEmail = originalEmail.substring(13);
// Set the modified email to an embedded data field
Qualtrics.SurveyEngine.setEmbeddedData('ModifiedEmail', modifiedEmail);
}
});
I then try to insert ${e://Field/RecipientEmail} and ${e://Field/ModifiedEmail} in the question. ${e://Field/ModifiedEmail} returns blank and ${e://Field/RecipientEmail} gives the email that we had in the upload file.
I apologize for my lack of knowledge but appreciate any help the forum grants me. Happy to correspond with additional details.