Unable to delete a Question Choice from a Multiple Choice variable

ewilks
Giga Expert

We have a Multiple Choice Question with 5 options.   I have been asked to delete one of those choices (there is no Active field, so I can't set it to inactive).   So I go into the variable, select the Question Choice that I want to delete, slide to the bottom and from the "Actions on Selected Rows..." dropdown I choose "Delete".   It pops up the confirmation box (see attached screenshot) and I click the Delete button.   But the question choice isn't deleted.   I've tried to do it by opening the Question Choice and clicking the delete button at the top of the form and it still won't delete. Does anyone know how I can remove this question choice?Delete_option.JPG

1 ACCEPTED SOLUTION

Hi Eric,



I ran into this issue after upgrading to Fuji.   What I found is that on the Question Choice[question_choice] table any choices that existed before the upgrade had no Class[sys_class_name]. What was happening when the class was null is that the SQL says Delete this record from NULL, which obviously doesn't work.   Here is a background script that I ran to set the Class, which then allows the records to be deleted.



var count = 0;


var grQuestion = new GlideRecord('question_choice');


grQuestion.addQuery('sys_class_name', '');


grQuestion.query();



while (grQuestion.next()) {


  grQuestion.sys_class_name = 'question_choice';


  grQuestion.update();


  count++;


}



gs.log("Questions updated: " + count);



Enjoy!


-Robert Chrystie


CareWorks Technologies


View solution in original post

7 REPLIES 7

gaf627
Tera Expert

We are experiencing the same issue.   Even an active flag would be helpful, so we could hide the choice.


I have a similar issue/question to the above.   I am able to delete the multiple choice option since I guess I was started on Fuji and never had to upgrade to Fuji.   But the problem is, if I delete the multiple choice option, then this value disappears from all existing RITM's that were submitted with this option.   I still want existing RITM records to show this value since it was valid, but I don't want it available going forward.   Since there is no 'Active' flag on the question choices, I can't just disable it.



Any have any luck on a solution?


CO1
Kilo Explorer

Change one of the values and resave then try again