How to make fields mandatory in ui action

test1231998
Tera Contributor

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

find_real_file.png

5 REPLIES 5

Mark Roethof
Tera Patron
Tera Patron

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

LinkedIn

Hi Thanks for the time But I need to update it into next state and also make it mandatory

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

LinkedIn

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