How to make fields mandatory in ui action
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-29-2020 03:38 AM
I have to make work notes and closed notes mandatory when I click on closed in Problem.So I have created a ui action for this.How can I add the conditions to make fields mandatory in this ui action.This is not working Can anyone please suggest and I am also not able to get the field name for work notes
- Labels:
-
Scripting and Coding

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-29-2020 03:41 AM
Hi there,
Your current script is using server side code and client side code mixed up. So first thing would be to fix this. For example by just using client side code.
g_form.setValue(etc
g_form.setMandatory(etc
g_form.save();
If my answer helped you in any way, please then mark it as helpful.
Kind regards,
Mark
2020 ServiceNow Community MVP
2020 ServiceNow Developer MVP
---
LinkedIn
Community article list
Kind regards,
Mark Roethof
Independent ServiceNow Consultant
10x ServiceNow MVP
---
~444 Articles, Blogs, Videos, Podcasts, Share projects - Experiences from the field
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-29-2020 03:52 AM
Hi Thanks for the time But I need to update it into next state and also make it mandatory

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-29-2020 03:55 AM
Obviously that won't work with a UI Action. A UI Action is just performed at that moment, if you would refresh the screen it's gone already.
If you want a certain field mandatory for certain states etc, then you need a UI Policy for example.
If my answer helped you in any way, please then mark it as helpful.
Kind regards,
Mark
2020 ServiceNow Community MVP
2020 ServiceNow Developer MVP
---
LinkedIn
Community article list
Kind regards,
Mark Roethof
Independent ServiceNow Consultant
10x ServiceNow MVP
---
~444 Articles, Blogs, Videos, Podcasts, Share projects - Experiences from the field
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-29-2020 05:41 AM
Hi,
While creating Ui Policy It is not working as expected When ever I press the closed button(for which the ui action is created) I need to make close notes mandatory.If UI policy is created theen after pressing the closed button only the fields become mandatory