- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
ā09-06-2021 08:47 AM
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
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
ā09-06-2021 12:14 PM
gs.addInfoMessage('Your message');
current.state=previous.state;
current.setAbortAction(true);
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
ā09-06-2021 08:54 AM
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
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
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
ā09-06-2021 10:03 AM
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
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
ā09-06-2021 10:10 AM
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
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
ā09-06-2021 10:37 AM
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,