Mandatory fields not working while saving
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-03-2022 05:02 PM
Hi Team ,
What could be the reason one of form is not validating mandatory fields while saving .
How can i fix this ? Looking forward your help in this .
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-03-2022 08:35 PM
"Save" looks like a custom UI action. It's possible that it's configured to ignore the mandatory fields. Can you post the code for the UI action?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-04-2022 08:20 PM
//&& new NCNTS_Utils().remediationPlanApprovalCheck(current)
function SaveRemeRecord(){
ignoreMandatoryCheck();
gsftSubmit(null, g_form.getFormElement(), 'save_reme_record');
}
if (typeof window == 'undefined')
Save_record();
function ignoreMandatoryCheck(){
var i;
var arrValues = g_form.getMissingFields().toString().split(',');
for (i=0;i<arrValues.length;i++){
g_form.setMandatory(arrValues[i],false);
}
}
function Save_record(){
if (current.u_verification_task_required == 'Yes' && current.state == 10 && current.u_associated_verification_task == ''){
var gr = new GlideRecord("u_verification_task");
gr.initialize();
gr.parent = current.parent;
gr.u_remediation_task_number = current.sys_id;
gr.assigned_to = current.parent.u_remediation_plan_owner;
var verID = gr.insert();
current.u_associated_verification_task = gr.sys_id;
action.setRedirectURL(gr);
gs.addInfoMessage('New Verification Action Created.');
}else{
action.setRedirectURL(current);
}
//current.state = -5;
current.update();
}

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-04-2022 10:10 PM
Check these out
https://servicenowguru.com/system-ui/ui-actions-system-ui/client-server-code-ui-action/
Regards,
Musab