Trying to think of the most elegant solution for the following:
We would like survey respondents to pick from a pre-specified list of dates/times for an information session. This list of dates and times will change as time goes on (when we reach the month of August, the list will show August and September dates; when we reach the month of September, the list will show September and October dates, etc.).
After the person submits, the survey will trigger a google calendar invite using the date and time that they pick in the survey using this: https://www.qualtrics.com/support/survey-platform/actions-page/tasks/google-calendar-task/
For example, there would be a question that asks them to pick a date/time:
August 6th @ 4:00PM
August 10th @ 3:00PM
August 13th @ 2:00PM
September 7th @ 10:00AM
September 10th @ 2:00PM
Based on their response, the workflow will create a google calendar event for that choice. I'm thinking that the the google calendar event will use the piped text from the date/time that they pick in the list, but I'm having trouble thinking about the best way to have these as separate fields, and likewise, how we should continually update the list. Any ideas?
Hi benjaminschenck,
This has probably come a bit too late for you, but wanted to share some ideas in the hopes it might help you in the future
Assuming you know all of the dates/times that will be made available, you could "automate" the updating of the list by doing the following -:
- Create an embedded data field with the following value -:
${date://CurrentDate/m}
. This will return the 2-digit month value based on today's date. - Use a multiple choice question to list out all of the possible sessions
- For each session (i.e. choice option) within the Multiple Choice question, configure display logic to display/hide based on the value of your embedded data field. This will allow the survey to dynamically present the relevant options in any given month based on the date on which the survey is being taken by the respondent.
As for piping in the Date and Time of the selected session into your Google Calendar task, you could try the following -:
- Create two additional embedded data fields "GoogleCalDate" and "GoogleCalTime"
- In your session selection Multiple Choice question, add the following JavaScript (which would obviously need to be expanded upon and edited based on your specific requirements) -:
Qualtrics.SurveyEngine.addOnPageSubmit(function()
{
if(jQuery("#"+this.questionId+" input.radio:checked").attr("choiceid")=="33") {
Qualtrics.SurveyEngine.setEmbeddedData("GoogleCalTime", "20:00");
Qualtrics.SurveyEngine.setEmbeddedData("GoogleCalDate", "2022-09-02");
}
if(jQuery("#"+this.questionId+" input.radio:checked").attr("choiceid")=="34") {
Qualtrics.SurveyEngine.setEmbeddedData("GoogleCalTime", "19:00");
Qualtrics.SurveyEngine.setEmbeddedData("GoogleCalDate", "2022-09-02");
}
});
Full disclosure, I'm no JavaScript expert so there's likely to be a more concise method of achieving what the above coding does. The output of this solution would be that when the respondent submits their response to the Multiple Choice session selection question, the JavaScript will use the selected option to set the values of the "GoogleCalDate" and "GoogleCalTime" embedded data fields, which can then be used for piping into your Google Calendar Task.
Hope that helps!
Cheers,
Cameron
Thanks Cameron - I ended up doing something similar to that, but saved each option as embedded data in the survey flow instead of through javascript. It's working so far, though is rather cumbersome to add new options. Not a big deal.
Hello
Thanks for your sharing, I’m Emily from Taiwan.
I’m wondering how did you design and set embedded data in the survey flow as you mentioned above. Can you please share the screenshots or some simple steps of creating the embedded data of every time choice? I have the same situation as yours, and really glad to see this article for the instruction.
Thank you sooooooo much!
Hi Emily - Here’s what it looks like in the survey flow. This is just one of many branches for however many time slots there are. And if you add slots over time, it requires maintenance because you need to update the survey choices and the embedded data to match those. After you create this structure, you reference those embedded data fields in the google calendar invite parameters.
Hello
Got it! Thanks for the sharing, I’ll try again on it.:)
Leave a Reply
Enter your E-mail address. We'll send you an e-mail with instructions to reset your password.