Need to make field mandatory before state close/complete
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-25-2023 03:16 AM
I need to make field mandatory before state close or complete using ui policy i made state is closed by I need before close how can I achive
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-25-2023 03:20 AM
can you please try below code -
Condition -
current.state == 'Closed'
Script:
if (current.getValue('field_name') == '') {
gs.addErrorMessage('The field_name field is required.');
current.setAbortAction(true);
return;
}
Please, don't forget to mark my answer as correct if it solves your issue or mark it as helpful if it is relevant for you!
Regards,
Tushar
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-25-2023 03:29 AM
Here where can I make filed mandatory directly abort condition
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-25-2023 03:25 AM
Hi @Gillerla Rajesh ,
I am not sure if I understood your question correctly , but while submitting whenever the state is closed completed u need to check if certain fields are filled or not, Make them mandatory if not.
For above u can create a OnSubmit script in which u can start with a condiiton if state is closed complete then check whether field is filled or not if empty make that field mandatory & return false.
Or u can make a particular field mandatory by creating UI policy with condition as State is in progress(just an example)
Thanks,
Danish
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-25-2023 03:26 AM
Can you share some screenshot of your UI policy & policy action please...!!!
ServiceNow Developer
I know one thing, and that is that I know nothing.
- Socrates