I have a follow-up survey and it’s first two questions are date dependent. first question is have you had your procedure yet. if the participants responds “no” they are asked to put in their new procedure data. this in turn triggers a workflow within the follow-up survey to send the same survey to the participant a day after their procedure. if they click no again and input a new date, this workflow repeats until they’ve had their procedure.
this works well for my initial follow-up survey. but i copied everything over for a new age group and the copy does not work. specifically, if i click ‘no’ and enter in a new date, i do not receive an email inviting me to the same follow-up survey.
this is the js from the copied question (ignore the repetition between the follow-up variables):
Qualtrics.SurveyEngine.addOnload(function() {
// Ensure Moment.js is loaded
var script = document.createElement('script');
script.src = "https://cdnjs.cloudflare.com/ajax/libs/moment.js/2.29.1/moment.min.js";
script.type = "text/javascript";
script.onload = function() {
// Get the date input from the survey question
var procedureDate = "${q://QID39/ChoiceTextEntryValue/1}".trim();// Ensure a valid date was entered
if (procedureDate) {
// Convert to a Moment.js date object
var procedureDateObj = moment(procedureDate, "YYYY-MM-DD");// Check if Moment.js successfully parsed the date
if (procedureDateObj.isValid()) {
// Format it back to YYYY-MM-DD for consistency
var procedureDateFormatted = procedureDateObj.format("YYYY-MM-DD");// Add one day to the procedure date
var followUp1Week = procedureDateObj.add(1, 'days').format("YYYY-MM-DD");
var followUp1Month = procedureDateObj.add(1, 'days').format("YYYY-MM-DD");
var followUp1day = procedureDateObj.add(1, 'days').format("YYYY-MM-DD");
// Store both values as Embedded Data in Qualtrics
Qualtrics.SurveyEngine.setEmbeddedData("procedure_date_formatted_java", procedureDateFormatted);
Qualtrics.SurveyEngine.setEmbeddedData("follow_up_1_day_java", followUp1day);
Qualtrics.SurveyEngine.setEmbeddedData("follow_up_1_week_java", followUp1Week);
Qualtrics.SurveyEngine.setEmbeddedData("follow_up_1_month_java", followUp1Month);} else {
console.error("Invalid date format:", procedureDate);
}
} else {
console.error("No date entered.");
}
};document.getElementsByTagName('head')[0].appendChild(script);
});
Qualtrics.SurveyEngine.addOnReady(function()
{
/*Place your JavaScript here to run when the page is fully displayed*/});
Qualtrics.SurveyEngine.addOnUnload(function()
{
/*Place your JavaScript here to run when the page is unloaded*/});
workflow looks like this:

any help would be great
