I added the question choices using a script but the label is not showing

Abigail
Tera Expert

I added using a script the question choices 

g_form.addOption('type_of_issue', choice.value, choice.label, choice.order);

 

But when i tried to get the label, what is showing is the value

producer.type_of_issue.getDisplayValue();

 

 

Any idea what else can tried?

1 ACCEPTED SOLUTION

Stefan Georgiev
Tera Guru

Hello @Abigail ,

I think that the problem is coming from there that when the Catalog Item is submitted, only the values are passed. What I can offer you as a solution if there are not that many options and you want to stick with the script you can add all possible options in the Dictionary, then remove in onLoad client script all the fields that you don't want initially with g_form.removeOption('priority', '1'), then you can use your logic to clear/populate the options<with you current scripts>, and when the form is submitted you are going to be able to see the Label for that value, because on that value there is a corresponding Label in the question_choice table.

Another approach might be to use and Lookup Select Box variable with an advanced reference qualifier and with some scripting you can do the same.

And your final option is a widget with an hidden field to show on the RITM/Task but lets hope that you don't go there.

Hope that this helps you!

If the provided information answers your question, please consider marking it as Helpful and Accepting the Solution so other community users can find it faster.

All the Best,
Stefan

View solution in original post

3 REPLIES 3

Community Alums
Not applicable

Hi @Abigail ,

Why are using a script to add the Choice? Why not using Dictionary?

Hello @Community Alums 

I used the script because the select box dependent on another select box

Stefan Georgiev
Tera Guru

Hello @Abigail ,

I think that the problem is coming from there that when the Catalog Item is submitted, only the values are passed. What I can offer you as a solution if there are not that many options and you want to stick with the script you can add all possible options in the Dictionary, then remove in onLoad client script all the fields that you don't want initially with g_form.removeOption('priority', '1'), then you can use your logic to clear/populate the options<with you current scripts>, and when the form is submitted you are going to be able to see the Label for that value, because on that value there is a corresponding Label in the question_choice table.

Another approach might be to use and Lookup Select Box variable with an advanced reference qualifier and with some scripting you can do the same.

And your final option is a widget with an hidden field to show on the RITM/Task but lets hope that you don't go there.

Hope that this helps you!

If the provided information answers your question, please consider marking it as Helpful and Accepting the Solution so other community users can find it faster.

All the Best,
Stefan