How to set more fields as mandatory when clicking on 'Resolve'

Alon Grod
Tera Expert

hi,

I have the field system_failute (True/false) on the incident table. I have a requirement that when the user click on the ui action 'Resolve' in the SOW, more fields should become mandatory in addition to close_code and close_notes. How can I achieve that?

6 REPLIES 6

Bert_c1
Kilo Patron

Hi Alon,

 

Use:  g_form.setMandatory('[field_name], 'true');

In the UI Action script for "Resolve" on your table.

 

As is done in the "Reopen Incident" UI Action.

Vishal Birajdar
Giga Sage

Hello Alon Grod,

 

When you click on "Resolve" button the "state" field get set to "Resolved".

You can just create "UI Policy" on incident table with condition "State=resolved" and create UI policy action to make other fields mandatory.

Here in my case I have made description field mandatory if we click on "Resolve"

 

VishalBirajdar7_0-1693807870170.png

 

Output :

When state is not resolved ,Description is not mandatory

 

VishalBirajdar7_3-1693808105000.png

 

 

When I click on Resolve button description is mandatory.

 

VishalBirajdar7_2-1693808070494.png

 

 

Hope this will help you..!!

 

 

 

 

Vishal Birajdar
ServiceNow Developer

I know one thing, and that is that I know nothing.
- Socrates

Rajesh_Bhise
Tera Guru

Hi @Alon Grod,

 

You can simply add 2-3 lines added to set fields mandatory based on requirement in the script field as shown below in the UI action "Resolve".

 

RajeshBhise1_0-1693809949986.png

 

This would surely resolve your concern easily. Please mark this answer as correct ✔️and Helpful👍.

 

Happy to help you ahead.

 

Thank You,

Rajesh Bhise

@jaheerhattiwale - Thanks for the support.

@Alon Grod  - Could you please review my solution and do the following ?

 

Please mark this answer as correct ✔️and Helpful👍

 

Thank You,

Rajesh