Cancel Change Record Without Completing Mandatory Fields for certain group

atul_05
Tera Contributor

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.

UI action - Cancel Change.png

7 REPLIES 7

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.

Runjay Patel
Giga Sage

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

-------------------------------------------------------------------------

Hi Runjay,

 

Fields should be editable to a specific group only and not to all users.