Close complete button not checking mandatory fileds in hr agent workspace
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-04-2024 02:50 AM - edited ‎10-04-2024 02:57 AM
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:
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-04-2024 04:01 AM
Hi @sri vijaya
You can check if the field is filled or not after making them mandatory and display the alert message. Try with something like below
function onClick(g_form) {
if (g_form.getTableName() == 'sn_hr_core_case_relations') {
g_form.setMandatory('u_case_outcome', true);
if(g_form.getValue('u_case_outcome') == '')
{
g_form.addErrorMessage('Case Outcome field is mandatory');
return false;
}
}
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.getValue('u_voe_tracking') == '')
{
g_form.addErrorMessage('voe tracking field is mandatory');
return 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.getValue('u_case_review_outcome') == '')
{
g_form.addErrorMessage('case review outcome field is mandatory');
return false;
}
if(g_form.getValue('u_capability_sanction') == '')
{
g_form.addErrorMessage('capability sanction field is mandatory');
return false;
}
}
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);
:
Also, looks like the script shared by you is incomplete, so modified your script only, I made the changes in the script where you are making the fields mandatory
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-06-2024 11:24 PM
i have pasted this script
But still the case is closing without the mandatory fields missing
we are using this type of button where closed complete /incomplete in same button (screenshot pasted here)
so is there any issue regarding this
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-07-2024 01:55 AM
Hi @sri vijaya
Can you check in platform view instead of workspace view to see the behaviour?
1. Create UI policy for each scenario to make the fields mandatory when the state -- is -- closed complete
2. Do you see the error messages on the screen when you click on that button?