Question

Remove Test Survey Data

  • 2 December 2015
  • 13 replies
  • 156 views

Userlevel 6
Badge +5
  • Gainsight Employee: Golden Ruler
  • 318 replies
We are trying to do some cleanup from some test surveys we did when we were implementing and trialling. 



The surveys won't allow me to delete them because they have responses. 



Any ideas on how to remove these?

13 replies

Hi Lane!  You can do this via a tool such as Workbench or Jitterbit by querying the Survey Response table then deleting records tied to the survey.  If you'd like me to walk to you through it, feel free to reach out to me via email and we can set up a time.



smorris@gainsight.com
For anyone else curious, we used Developer Console to delete all survey responses and participants to the specific surveys.  We deleted all records from both objects as they were just test records.  If you are deleting these for specific surveys, a WHERE clause would need to be added to the delete line.



1.  delete [SELECT Id FROM JBCXM__SurveyResponse__c];



2.  delete [SELECT Id FROM JBCXM__SurveyParticipant__c];
Hi Scott - had a question about your response. What is the functional difference between a SurveyResponse and a SurveyParticipant? I'm looking into different ways to query the system and wasn't sure how these two objects differentiated and worked
Hi Billy:



If you're using the standard Survey functionality (not Copilot) then here are how the objects interact:



When you add participants to the survey, they are added as records in the JBCXM__SurveyParticipant__c object.  Once they respond, their answer (with a lookup to the Participant object), is store in the JBCXM__SurveyResponse__c object.



Let me know if this helps.



Scott
Gotcha - that makes sense! Thanks Scott. How about in the Copilot scenario? 
In the case of Copilot, the response record is created in the same fashion, however the participant record isn't created until the user responds to the survey.  
Got it. Thanks again Scott! 🙂
HI Scott,

Are there plans to allow for deletion of survey's through your interface? Seems that it would be more efficient than to do hard queries.



Thanks

Richard
Badge
Agree with Richard. Capability to delete an unwanted survey is needed.
Badge
One added note, I deleted the Survey Response and Survey Participant records, and was then able to delete the survey via the UI. Apparently the survey is not really deleted, because it was appearing in the reports on the NPS tab dashboard. So I had to hard delete the survey record from the NPS Survey Master object.
Userlevel 5
Badge +5
Richard,



While I am not saying any of our customers would actually do this, that may open up the door to manipulate survey data. I am not sure if that is why our product doesn't allow a clean way to remove responses now, but it might have played a part during design. Maybe product can chime in here :)



My request would be to be able to create a survey and specify it as a test which would allow you to manipulate the responses and eventually delete it along with the responses at the same time.
Badge
Good idea - designate a survey as Test up front. As a result it is excluded from the NPS reports and scores. That's really all we were trying to do.
I was asked to delete a particular survey (all I had was title) and its related data. Here are the queries I ran (and the order in which I ran them):


  1. select id from JBCXM__SurveyResponse__c where JBCXM__SurveyParticipantId__r.JBCXM__SurveyMaster__r.JBCXM__Title__c = 'YOUR SURVEY NAME HERE'
  2. select id from JBCXM__SurveyParticipant__c where JBCXM__SurveyMaster__r.JBCXM__Title__c = 'YOUR SURVEY NAME HERE'
  3. select id from JBCXM__Survey__c where JBCXM__Title__c = 'YOUR SURVEY NAME HERE'
The process is


  • run query 1
  • delete records with resulting ids from query 1
  • run query 2
  • delete records with resulting ids from query 2
  • run query 3
  • delete records with resulting ids from query 3
  • drink a glass of wine because you deserve it. :-)
I hope this saves someone else from an afternoon of trial and error! 🙂

Reply