- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-03-2025 12:29 AM
I am making field assigned to Non-mandatory while resolving when there is an external reference record attached over the related list of incident, for this i have written script include and client script and not getting solution
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-03-2025 01:27 AM
Hi @ABC6 , Is the current user part of the assignment group you selected? If he is not, then it is directly returning false, even if the reference record exists in 'u_external_references' table.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-03-2025 02:47 AM
it is reference field
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-03-2025 12:56 AM
Fixed Script Include:
var ResetAssignee = Class.create();
ResetAssignee.prototype = Object.extendsObject(AbstractAjaxProcessor, {
isUserMember: function() {
var userGrp = new GlideRecord('sys_user_grmember');
userGrp.addQuery('user', this.getParameter('sysparm_usr'));
userGrp.addQuery('group', this.getParameter('sysparm_grp'));
userGrp.setLimit(1);
userGrp.query();
if (userGrp.next()) {
var incidentId = this.getParameter('sysparm_is_external_reference');
var gr = new GlideRecord('u_external_references');
gr.addQuery('u_task', incidentId);
gr.setLimit(1);
gr.query();
// Return 'true' if an external reference exists, else return 'false'
return gr.next() ? 'true' : 'false';
}
return 'false';
}
});
Fixed Client Script:
if (g_form.getViewName() == 'sow_incident_resolve_modal' || g_form.getViewName() == 'ui16_incident_resolve_modal') {
if (isLoading || newValue === '') {
g_form.setMandatory('comments', true);
g_form.setMandatory('assignment_group', true);
}
if (g_form.getValue('assigned_to') == '') {
var getGroup = new GlideAjax('ResetAssignee');
getGroup.addParam('sysparm_name', 'isUserMember');
getGroup.addParam('sysparm_usr', g_user.userID);
getGroup.addParam('sysparm_grp', g_form.getValue('assignment_group'));
getGroup.addParam('sysparm_is_external_reference', g_form.getUniqueValue());
getGroup.getXMLAnswer(function(response) {
if (response === 'true') {
g_form.setMandatory('assigned_to', false);
} else {
g_form.setMandatory('assigned_to', true);
}
});
}
}
✔️ If this solves your issue, please mark it as Correct.
✔️ If you found it helpful, please mark it as Helpful.
—
Shubham Jain
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-03-2025 01:18 AM
Not Working
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-03-2025 01:27 AM
Hi @ABC6 , Is the current user part of the assignment group you selected? If he is not, then it is directly returning false, even if the reference record exists in 'u_external_references' table.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-03-2025 01:33 AM
it is empty i have not selected any thing in the assigned to or you are refering current logged in user