Drop-down question choice to feed into email to the person chosen? | XM Community
Skip to main content
I have a drop-down question in my survey to choose a staff member and ideally, this would cause an action of sending a default message to this staff's email. Is there someway to embed data or tie the staff to an email address? I have hundreds of staff to choose from (that selectively display depending on answers to previous questions) and want the action to cause that staff to be emailed once the response is completed but I don't want to create a hundred separate actions for each individual staff. Work arounds?
I think you can hide the email address in your choice, then extract it with JS.



Choice html:

```

Firstname Lastname<span class="staffEmail" style="display:none">email address</span>

```

Then use an addOnPageSubmit function to find the selected choice, extract the email address and save it to an embedded data variable.
Would this still require assigning a staff email address manually to a specific name? For example if the drop in has Jane Doe and Bob Smith. If they choose Bob, then I would need to house the record of his email address in the question itself right?
> @cma said:

> Would this still require assigning a staff email address manually to a specific name? For example if the drop in has Jane Doe and Bob Smith. If they choose Bob, then I would need to house the record of his email address in the question itself right?



Yes, that is the idea. The email would be embedded in the choice. Then you can extract it from whichever choice is selected.

```

Bob Smith<span class="staffEmail" style="display:none">bob.smith@yourdomain.com</span>

```
@TomG thank you for this!



I'm wondering if there is any other way to house this data with the email addresses. The idea of manually typing for 100+ individual staff and their emails is an administrative burden for sure. Is there some way to have this data filter in from a contact list or similar found on the files part of my account? Is something like this possible through Qualtrics?
> @cma said:

> @TomG thank you for this!

>

> I'm wondering if there is any other way to house this data with the email addresses. The idea of manually typing for 100+ individual staff and their emails is an administrative burden for sure. Is there some way to have this data filter in from a contact list or similar found on the files part of my account? Is something like this possible through Qualtrics?



You can store them externally (e.g., on your own web server/host) and bring them in through a web service call. You could also use JS/ajax. I guess it all depends on how dynamic they are. If they aren't going to change during fielding of the survey, it would probably be easier to format them in a spreadsheet, then copy and paste it into the survey.



Since it is a fairly long list, you may want to use select2, which would make the dropdown searchable and provide more flexible data options such as a JS object that contains the names and emails.

Leave a Reply