Option to make Variable Madatory or unselect "greyed out"

Adil N
Tera Expert

I have a couple of variables in a variable set, which should be hidden until certain conditions in a UI policy are triggered. however for some reason the ability to check/uncheck the "Mandatory" option for these variables are greyed out and when loading the record producer the variables appear with the mandatory Asterix and the UI polices do not work unless i cycle through the options. 

 

I have checked if the variable set is linked to any other UI policies which does not seem to be the case. the UI polices are set to "On Load" 

 

any ideas?  

1 REPLY 1

VishalM80230675
Tera Contributor

It sounds like you're dealing with some frustrating issues with ServiceNow variables, especially with the "Mandatory" option being greyed out. Here are a few things you can try to troubleshoot and hopefully resolve this:

  1. Double-Check UI Policies:

    • Make sure there are no other UI policies conflicting with the ones you're working on. Sometimes, overlapping policies can cause unexpected behavior.
    • Verify that the conditions in your UI policies are set correctly and that the actions to make fields mandatory or optional are as they should be.
  2. Look at Client Scripts:

    • Check if there are any client scripts that might be changing the mandatory state of your variables. These scripts can sometimes override UI policies.
  3. Variable Set Configurations:

    • Since your variables are in a variable set, ensure there aren't any settings at the set level affecting individual variables.
  4. Execution Order Matters:

    • UI policies set to "On Load" should kick in when the form loads. Ensure there are no other scripts or policies executing in a way that messes with this order.
  5. Form Layout Issues:

    • Make sure your form layout isn't causing problems with how the fields appear and behave.
  6. Inherited Properties:

    • Check if the variables are inheriting properties from somewhere else, like a parent record, which might be causing conflicts.

Here are some specific steps to try:

  • Reset UI Policy Actions:

    1. Open the UI Policy Actions for the variables.
    2. Make sure the "Mandatory" checkbox is set correctly based on your needs.
    3. Save the policy and reload the form to see if it works.
  • Toggle UI Policies:

    1. Temporarily disable the relevant UI policies.
    2. Reload the form to see if the variables still show as mandatory.
    3. Re-enable the policies and check if they are working as expected.

If these steps don't fix the issue, you might want to:

  • Create a Debug Log:

    • Turn on client-side debugging in ServiceNow to see what scripts and policies are running when the form loads. This can help pinpoint any problems.
  • Review Customizations:

    • Look at any customizations or updates in your instance that might be interfering with the variables.

I hope these suggestions help! Let me know if you need more assistance or if there's anything else you'd like to try.