Newbie: can't get a simple UI policy action to work
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-02-2025 10:08 AM
Hi all.
I'm a total newbie to working with ServiceNow, lengthy background in coding. This is a no code question.
I am taking a developer course with Now Learning, and in the current lab (4.2a), I was to build a form in studio, add a choice box with a number of choices, the last choice being "Other". Then I was to add a string field below it named Other/other.
I should add that the instance asked me if I would like to use the newer tool, but the lab said to stick with the older one, so I did. I can't think of the names of the two tools at the moment.
You probably know where this is going.
Next I add a UI Policy, make it active, global, an run on load (and not Inherit).
The table for the policy is the only table in the app.
The condition was Depot (the choice field) is Other.
I did all of this and saved the UI policy.
Next was to set up the UI policy action, namely when the person elects Other from the choice list, the Other box will become a visible and mandatory field.
I created the new policy action, I set the field to Other, made it Mandatory True and Visible True. Then I hit Submit.
That was all of the instruction.
Next step is test.
I try to make a new record for my app.
The default choice is set to Other and since the UI Policy was set to on Load, I assume that means it would pop out the Other field upon load, but it didn't. I tried changing the value in the choice list to different values and back to other, but nothing happens. The Other field never appears no matter what, and no errors or odd behavior. Just no reaction at all. Since the course and labs are progressive, I think I should stop moving forward until this gets resolved.
I Googled for answers, but the suggested remedies were not spelled out in my level of ServiceNow familiarity.
I deleted the Other field and the Policy and the Policy action, and I repeated the lab from the start (the table and form were created in prior labs). All of my screens look exactly like the screens in the textbook.
It's a fairly short lab and I'm content to try it multiple times, but I would sure like to know what the problem could be with a new app, no scripting so far, and just one table and a form.
All ideas, thoughts, and recommendations are welcome.
Thanks.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-02-2025 10:30 AM
Hi @wengang1 Is there a conflicting logic? may be a client script written on this?
Let me know if this helps, if not then maybe we can connect and figure it out.
Can you verify the steps below:
1. Check UI Policy Order:
UI policies execute in order based on their "Order" field. If multiple policies affect the same fields, the last one to execute (highest order) will take precedence. If your policy has a lower order than another affecting the same fields, it might be overridden.
2. Verify Policy is Enabled:
Ensure the UI policy is active and not disabled. A disabled policy will not execute any actions.
3. Examine Client Scripts:
Client scripts can also manipulate fields, and conflicting logic can prevent the UI policy from working as expected. Check for any client scripts that might be hiding, making mandatory, or otherwise modifying the same fields as your UI policy.
4. Check for Browser Issues:
Sometimes, browser-specific issues can cause UI policies to malfunction. Try clearing your browser cache or testing in a different browser to rule out this possibility.
5. Review UI Policy Actions:
Ensure the actions defined in the UI policy are correctly configured and target the intended fields. For example, if hiding a field, confirm the "visible" attribute is set to "false".
6. Consider Variable Sets:
When dealing with variable sets on catalog items, be aware that UI policies within a variable set might not take precedence over catalog item UI policies, even if their order is higher according to ServiceNow.
7. "Reverse if False":
If the "Reverse if false" checkbox is selected, the UI policy actions will be reversed when the conditions are not met. Make sure this setting aligns with your intended behavior.
8. "Use as UI Policy on client":
If the UI policy is part of a data policy, make sure the "Use as UI policy on client" option is selected if you want the policy to immediately affect the form when the data policy condition is met.
9. Field Type and Dictionary:
Check the dictionary for the field you're targeting. If it's mandatory and being hidden by the UI policy, it might not work as expected. You might need to make the field non-mandatory or use a different approach.
10. Duplicate Variable Names:
When using catalog variables with "Map to field," be careful not to give two variables the same name, as this can cause issues with UI policies and field mapping according to ServiceNow.
11. Test in a Clean Environment:
If possible, try testing the UI policy in a clean environment (e.g., a new browser profile or an instance without customizations) to isolate the issue.
12. Check for Existing Data:
If the UI policy isn't working on existing records, ensure the field values are correctly set to trigger the policy's conditions.
Mark my answer helpful if it helped you 🙂
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-02-2025 10:31 AM
Hi @wengang1 ,
- Make sure the Other field is actually on the form layout. Sometimes fields are created but not added to the form view, so they won’t be affected by UI Policies.
- Ensure the Other field is not set to hidden by default in the form layout or dictionary settings. If it’s hidden at the dictionary level, UI Policies won’t be able to show it.
Mark this as helpful and correct if this helps.
Thanks
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-02-2025 10:32 AM
Hi @wengang1 ,
did you reload the form after making the changes?
Please mark my answer as helpful/correct if it resolves your query.
Regards,
Chaitanya
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-02-2025 10:32 AM
A picture is worth a thousand words. Show screenshots of the UI Policy and UI Policy Action related list.