Anyway to set a field to accept unique entires only? | XM Community
Skip to main content

I'm trying to setup a survey and it collects a unique user ID as input from the user. Is there a way to validate this field to let the user continue only if that ID is new?
ps; I tried the contacts route, but seems like the subscription I have through our institute does not support it.
Thank you

Hi Cyril,
If you have access to the API, you can search for a contact using that information. If it returns 0 results, then you know the ID is unique.
Good luck!


https://community.qualtrics.com/XMcommunity/discussion/comment/49595#Comment_49595Hi bgooldfed, I can't use the contact feature because our institution does not have access. Is there any other way to do this?
Looks like you don’t have permission to access the Qualtrics XM Directory. Please contact your organization's Qualtrics admin to gain access to XM Directory contacts.



https://community.qualtrics.com/XMcommunity/discussion/comment/49598#Comment_49598My bad! It will be a bit trickier then. You will need some way to store/update unique IDs and then search them. Do you have access to create workflows and datasets? (You can find workflows in the dropdown menu, and datasets from Create project -> Imported Data). You might be able to use these to update a list of unique IDs every time the survey completes, and check against that list whenever somebody enters a unique ID during the survey.
If you don't have access to those, you'll need to store/update the IDs on an external database service with a REST API (eg: MongoDB, restDB) and then POST/GET information from the database during your survey via a Web Service (in the Survey Flow or with Javascript).
Obviously the former is a lot cleaner but may not work depending on your license.


https://community.qualtrics.com/XMcommunity/discussion/comment/49599#Comment_49599Annoyingly the first method, I don't have access to datasets through the license we have. The workflow shows up but I can't create a data project. So I guess that is out. But I was trying out with workflow to save the data to a google sheet, and then to do a lookup from the google sheet. How can I do the data comparison though? As in retrieve the list when someone starts the survey for comparing?
For the second, I've been trying with this but seems like I'm missing something? https://community.qualtrics.com/XMcommunity/discussion/22320/using-web-service-as-a-unique-field-validation-where-is-it-going-wrong#latest


Would it be easier just to turn on the preventing multiple submissions feature? It sounds like this is going to be very complicated to set up with less return on your time.

https://www.qualtrics.com/support/survey-platform/survey-module/survey-options/survey-protection/#PreventingRespondentsFromTakingYourSurveyMoreThanOnce


https://community.qualtrics.com/XMcommunity/discussion/comment/49616#Comment_49616I already have that enabled + workflow to exit when duplicates come in and still people can get through.


https://community.qualtrics.com/XMcommunity/discussion/comment/49606#Comment_49606You can fetch the sheet for comparing using Google Apps Script API.
A nice summary I found on StackOverflow: https://stackoverflow.com/a/49550441
Note that if you'll be using an external library (like axios) you will need to import it in Qualtrics by adding it to the header.

I'm no good with PHP so can't help with your other thread :(


Leave a Reply