Some of the choices of selected variables are not showing on RITM and Catalog task

rekhamacha
Tera Contributor

Added below script to the following UI Policy and all other choices of selected variables are showing it on RITM & catalog Task except "Any Dollar Amount Budget Documents", Zero Dollar Budget Documents".

 

rekhamacha_0-1778765866248.png

 

5 REPLIES 5

Ankur Bawiskar
Tera Patron

@rekhamacha 

any other client script or UI policy is removing those choices?

Regards,
Ankur
Certified Technical Architect  ||  10x ServiceNow MVP  ||  ServiceNow Community Leader

Ankur, thank you for response.

No, there is no other client script removing those choices.

@rekhamacha 

are you sure you are using correct choice value and label in your script?

Regards,
Ankur
Certified Technical Architect  ||  10x ServiceNow MVP  ||  ServiceNow Community Leader

Vikram Reddy
Giga Guru

Hi @rekhamacha ,

 

This looks like a choice/value configuration issue, not a RITM or Catalog Task issue.

In your script, you are using g_form.addOption() and g_form.removeOption(). These methods only change the options that are visible in the current client-side form. They do not create or update the actual catalog variable Question Choice records.

 

For RITM and Catalog Task, ServiceNow displays the submitted variable value by resolving it against the catalog variable’s Question Choices. If the stored value does not exist as a real Question Choice, or if the value does not match exactly, the selected choice may appear blank or may not display correctly in the variable editor.

 

Please check these items:

1. Open the catalog item.
2. Open the variable document_access.
3. Go to the Question Choices related list.
4. Confirm that these choices exist as actual Question Choice records:

Text: Any Dollar Amount Budget Documents
Value: any_dollar_amount_budget_documents

Text: Zero Dollar Budget Documents
Value: zero_dollar_budget_documents

5. Make sure the Value used in the script exactly matches the Question Choice Value.

 

If the actual Question Choice value is plural, for example:

zero_dollar_budget_documents

then the script value is wrong. Choice values must match exactly.

Also, make sure these choices are not inactive.

 

Another important point:

If this Catalog UI Policy is configured to apply on Requested Items and Catalog Tasks, then the same removeOption() logic may run on the RITM/SCTASK variable editor. If the selected option is removed on load, it can look like the value is not showing.

For this type of logic, I would normally apply the option filtering only on the Catalog Item view, not on RITM and Catalog Task.

 

Check these:

- Add all possible choices as real Question Choices on the variable.
- Use removeOption() only to hide choices from the requester on the catalog item form.
- Do not rely on addOption() to create choices dynamically.
- Do not run this option-hiding UI Policy on RITM/Catalog Task unless you specifically need it there.
- Make sure the value in removeOption/addOption exactly matches the Question Choice value.

 

Example:

g_form.removeOption('document_access', 'any_dollar_amount_budget_documents');
g_form.removeOption('document_access', 'zero_dollar_budget_documents');

If you still need to add options back in the false script, use the exact same values that exist in Question

 

Choices:

g_form.addOption(
'document_access',
'any_dollar_amount_budget_documents',
'Any Dollar Amount Budget Documents'
);

g_form.addOption(
'document_access',
'zero_dollar_budget_documents',
'Zero Dollar Budget Documents'
);

 

Create these options as actual Question Choices on the variable and verify the stored values match your script exactly. g_form.addOption() only adds choices on the current form; it does not create backend catalog choices. Also check that your UI Policy is not removing the selected options on the RITM and Catalog Task views.

 

Thank you,

Vikram Karety

ServiceNow Architect

Octigo Solutions INC