Join the #BuildWithBuildAgent Challenge! Get recognized, earn exclusive swag, and inspire the ServiceNow Community with what you can build using Build Agent.  Join the Challenge.

Variable values not getting cleared on request summary

siqbal
Tera Contributor

I have a form with several Catalog UI Policies configured. When I fill out a field on the form and then change my selection in a question above it, the variable value is cleared on the form as expected, based on the Catalog UI Policy. However, the cleared variable still appears in the Request Summary/Additional Details section. Since our approval email pulls data from the Request Summary/Additional Details, variables that are no longer visible on the form are being included in the email, even though they were cleared on the form itself.

I’ve tried various approaches to ensure these cleared variables don’t appear in the Request Summary, including using Catalog UI Policies, but the issue persists. I even built a script to clean them out, which works perfectly, but my manager wants this resolved without relying on a script. These variable does not appear on request item or the catalog task just on request summary. Can not hide the variable itself from summaries as we still want them to be sent out when end user does select/ fill them out.

Any help / suggestions would be apricated.

Thanks  

5 REPLIES 5

Ankur Bawiskar
Tera Patron
Tera Patron

@siqbal 

it means variable is not getting cleared when user submits the REQ.

If it's present in this table (sc_item_option_mtom) it will show in Request Summary

Ensure your UI policy or client script clears the variable values when it's hidden from form

If my response helped please mark it correct and close the thread so that it benefits future readers.

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

siqbal
Tera Contributor

Thanks for your reply, the issue was I was making the variables visible with my catalog UI policies instead of hiding them and the clear variable value only works for a catalog UI policy when you are hiding the variable instead of showing it

Hi @siqbal Are you able to figure out the reason for this? We are having the same issue on our catalog item where the value is clearing out when options are changed based on UI policy. When when the request is submitted the cleared variable is showing up in the variable summary.

Yes, I was able to fix the issue. Here's how:

To make a variable visible based on another variable's value, you first need to ensure the variable is initially visible. For example, let's say we have a variable called A (with values 1, 2, and 3). When A is set to 1, we want to make another variable, B, visible.

To achieve this, you can create a catalog UI policy with the following logic:

  • If the value of A is not 1, then hide variable B and clear its value.

Keep in mind that the "Clear Value" action in a catalog UI policy only works when the variable is hidden, not when it is made visible.

  • If A = 1, B becomes visible (no clearing of value happens).
  • If A ≠ 1, B is hidden, and its value is cleared automatically.

I hope this helps clarify the process!