Deactivating a drop-down question choice selection from a Select Box variable

ravi_otpp
Tera Expert

Hi SN DEV Community!

I understand that currently the 'Question Choice' table located within a Select Box variable does not contain an active flag, as a result we're unable to mark a selection as inactive. While we can delete the item, this goes against our internal best practice guidelines as well as pose an issue if a report is later created and filtering on the deleted item.

As a result, are there any preferred methods in which to deactivate the drop-down question choice selection from the select box?

Some items I was considering were:

  1. Create a custom u_active attribute on the question choice table, however, i haven't been able to find a good method in which to do this yet
  2. Create a stand-alone onLoad client script on the form to simply hide the drop-down selection, although this can get messy over time as well as contribute to a slight performance impact on the form

Thanks.

Ravi

1 ACCEPTED SOLUTION

Alok Das
Tera Guru

Hi Ravi,

I do understand your concern, and unfortunately we do not have the active field on the "question_choice" table due to which we can not deactivate any choice from the variable.

For your first consideration, I believe you can do that by creating a before - query business rule on "question_choice" table and add the below code which will restrict the querying of the choice records which are active false, however you will face an issue where the choices which will be turned false will exist in system but not be visible, neither in the drop-down nor in the list.

current.addQuery('u_active','true');

I would suggest you to go with your Second consideration, and have a OnLoad Client Script, and add the below piece of code:

g_form.removeOption('field_name','choice_value');

 

Also, I do agree that Client Script downgrade the  system performance while loading the form, however I believe a small piece of code in your scenario is not going to hamper much....!

 

Kindly Mark my answer as Correct/Helpful based on the impact.

Regards,

Alok

View solution in original post

2 REPLIES 2

Alok Das
Tera Guru

Hi Ravi,

I do understand your concern, and unfortunately we do not have the active field on the "question_choice" table due to which we can not deactivate any choice from the variable.

For your first consideration, I believe you can do that by creating a before - query business rule on "question_choice" table and add the below code which will restrict the querying of the choice records which are active false, however you will face an issue where the choices which will be turned false will exist in system but not be visible, neither in the drop-down nor in the list.

current.addQuery('u_active','true');

I would suggest you to go with your Second consideration, and have a OnLoad Client Script, and add the below piece of code:

g_form.removeOption('field_name','choice_value');

 

Also, I do agree that Client Script downgrade the  system performance while loading the form, however I believe a small piece of code in your scenario is not going to hamper much....!

 

Kindly Mark my answer as Correct/Helpful based on the impact.

Regards,

Alok

ravi_otpp
Tera Expert

Thanks Alok!

Ravi