Cancel Change Record Without Completing Mandatory Fields for certain group
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-13-2024 11:49 PM
Hello Team,
I have a requirement to Cancel Change Record Without Completing Mandatory Fields for a xyz group. Can you please help me on how we can achieve this?
There is a UI action already but I am not sure how to proceed with this requirement and how to configure.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-15-2024 09:53 PM
Hi @atul_05 ,
Even on change client script will not work, as the code is not changing the state,
You can use On change client script, with one line in UI Action, which makes state = Cancel on the client side.
g_form.setValue('state', ' <cancel> ');
The way, how when Resolve button is clicked, resolution code and resolution notes become mandatory.
Regards,
Najmuddin.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-16-2024 01:07 AM
Hi @atul_05 ,
Use below code in your client side script of ui action
var fields = g_form.getEditableFields(); // Get all editable fields on the form
alert(g_form.isMandatory('short_description'));
for (var i = 0; i < fields.length; i++) {
var fieldName = fields[i];
if (g_form.isMandatory(fieldName)) {
g_form.setMandatory(fieldName, false);
}
}
-------------------------------------------------------------------------
If you found my response helpful, please consider selecting "Accept as Solution" and marking it as "Helpful." This not only supports me but also benefits the community.
Regards
Runjay Patel - ServiceNow Solution Architect
YouTube: https://www.youtube.com/@RunjayP
LinkedIn: https://www.linkedin.com/in/runjay
-------------------------------------------------------------------------
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-21-2024 10:37 PM
Hi Runjay,
Fields should be editable to a specific group only and not to all users.