Application scope script include GRC: Advance Core
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-03-2025 04:19 AM - edited 08-03-2025 04:25 AM
Hi ,
I want creaate a script include and client script for GRC:Advance core Issue triage,
in onload client script wrote to get value of field and call a script inlude to fetch particular group based on that field value. But the script include not triggering from the client script please help me.
@Dr Atul G- LNG
;
Onload:
function onLoad() {
//Type appropriate comment here, and begin script below
var division = g_form.getValue('variables.division');
g_form.addInfoMessage ('Division '+division);
if (division === '') {
g_form.setValue('assignment_group', '6e2e*****************');
return;
}
var ga = new GlideAjax('DivisionAssignmentUtil');
ga.addParam('sysparm_name', 'getAssignmentGroupSysId');
ga.addParam('division', division);
ga.getXMLAnswer(function(response) {
if (response) {
g_form.addInfoMessage('Group '+response);
g_form.setValue('assignment_group', response);
}
});
}
script include:
DivisionAssignmentUtil.prototype = Object.extendsObject(AbstractAjaxProcessor, {
getAssignmentGroupSysId: function() {
var division = this.getParameter('sysparm_division'); // ✅ Correct usage
if (!division) return '';
// Mapping division values to group names
var divisionToGroupName = {
'group_AB': 'AB Risk',
'group_XX': 'XX Group',
};
var groupName = divisionToGroupName[division];
if (!groupName) return '';
var gr = new GlideRecord('sys_user_group');
gr.addQuery('name', groupName);
gr.setLimit(1);
gr.query();
if (gr.next()) {
return gr.getValue('sys_id');
}
return '';
},
type: 'DivisionAssignmentUtil'
});
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-03-2025 06:32 AM - edited 08-03-2025 06:32 AM
I your onload client script parameter name is mismatch at line number 10, it should be:
ga.addParam('sysparm_division', division); // ✅ Fixed parameter name
note: you can add gs.info('DivisionAssignmentUtil called for division: ' + division); in script include so you can verify actual value
plz accept as solution and helpful, if this solve you issue.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-03-2025 08:39 AM
Hello @Arun_Manoj , Your CS and SI are not aligned to use the 'division' parameter.
Either change client script as
//ga.addParam('division', division);
ga.addParam('sysparm_division', division);
or change SI as
//var division = this.getParameter('sysparm_division'); // Correct usage
var division = this.getParameter('division');
Regards,
Nishant