How to make field mandatory on incident form

kumaraj
Kilo Sage

Hi All,

I have a requirement mentioned below, could someone help me to achieve it.

Right now Category field and subcategory fields are not mandatory.

when we make category/subcategory fields mandatory by Client script/UI Policy even then  the user is able to resolve incident bypassing mandatory fields. Now I was told that remove the mandatory tag from both the fields and create a BR which can perform below:

Requirement: If someone tries to update state field then 

if(current.state.changesTo('Resolved/In progress/On hold') && current.category || current.subcategory =='')

then system should abort the action with a message that please category and subcategory filed.

This BR should also prevent updating state when user trying to update by sending email or via service portal. (This is main requirement)  

Thank you

1 ACCEPTED SOLUTION

Upender Kumar
Mega Sage

find_real_file.png

 

	gs.addInfoMessage('Your message');
	current.state=previous.state;
	current.setAbortAction(true);

View solution in original post

15 REPLIES 15

Voona Rohila
Kilo Patron
Kilo Patron

Hi kumaraj

Try this

if(current.state.changesTo('6') && (current.category == '' || current.subcategory == ''))
{
gs.addErrorMessage("your message here");
current.setAbortAction(true);
}

or you can configure like this

find_real_file.png

find_real_file.png


Mark it helpful if this helps you to understand. Accept solution if this give you the answer you're looking for
Kind Regards,
Rohila V
2022-25 ServiceNow Community MVP

Hi Rohila,

I have already tried that but it does show message in BR but i guess by another business rule It hets resolved and show the message that Incident is resolved as below:

When I reload it again then it auto changes from "Resolved" to "in progress". I do not want "Incident XXXX123 resolved message" and should not need to reload it to get the state "In Progress" from Resolved

find_real_file.png

Can you give more info on how you are making state to resolved.


Mark it helpful if this helps you to understand. Accept solution if this give you the answer you're looking for
Kind Regards,
Rohila V
2022-25 ServiceNow Community MVP

Hi Rohila,

On incident form there are two way we can resolve:

Either we can select Resolve choice from State field and save or We can click on "Resolve" UI action.

Both way I am facing the same issue as I mention above.

 

Thank you,