Close complete button not checking mandatory fileds in hr agent workspace

sri vijaya
Tera Expert

Hi

In HR agent workspace, in HR case when we click the close complete button, if the mandatory fields are not filled- getting the alert error that mandatory fields are not filled but action of closing the case is happening which should not happen

If the alert is asking to fill the mandatory fields , after filling the fields then case can be closed

and we have some mandatory fields which is defined in ui action client script pasted below

so is there any corrections required for this client script ?

Please help me to resolve the issue

 

 

client script in UI action:

function onClick(g_form) {
    if (g_form.getTableName() == 'sn_hr_core_case_relations') {
        g_form.setMandatory('u_case_outcome', true);
 
    }
 
 
    if (g_form.getTableName() == 'sn_hr_core_case_payroll' && g_form.getValue('assignment_group') == '55cb7eb61b243300ce6996002d4bcb72') {
        g_form.setMandatory('u_voe_tracking', false);
    }
    if (g_form.getTableName() == 'sn_hr_core_case_relations' && g_form.getValue('u_region') == 'APAC') {
        g_form.setMandatory('u_case_review_outcome', true);
        g_form.setMandatory('u_capability_sanction', true);
    }
    if (g_form.getTableName() == 'sn_hr_core_case_relations' && g_form.getValue('u_region') != 'APAC') {
        g_form.setDisplay('u_case_review_outcome', false);
        g_form.setDisplay('u_capability_sanction', false);
    }
 
 
    var get_info = new GlideAjax('sn_hr_core.GetHRProfiledetails2');
    get_info.addParam('sysparm_name', 'getHRFieldsFromUserID');
    get_info.addParam('sysparm_userID', g_form.getValue('subject_person'));
    get_info.getXMLAnswer(getdetails);