Need to add property value in script include
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
ā01-28-2022 04:10 AM
Hi All,
Actually there is a script include definition where the assignment group value is setting based on CI and category value.
for few category's we have defined some assignment group sys ID in the script include, but now i just replaced the sysID with the system property which i have created for each group. but that is not working. Please suggest.
Before adding the property the code was like this and it was working fine.
CIAssignmentgroup: function(cmdb_ci) {
cmdb_ci = JSUtil.nil(cmdb_ci) ? this.getParameter("sysparm_cmdb_ci") : cmdb_ci; // Passing cmdb as parameter
var category = this.getParameter("sysparm_category").toString(); //Passing category as parameter
var gr = new GlideRecord("cmdb_ci");
gr.addEncodedQuery('sys_id=' + cmdb_ci + '^support_groupISNOTEMPTY');
gr.query();
gs.log("TR:cat " + category);
if (gr.next()) {
var support = gr.getValue("support_group"); //Getting the value of CI's support group
return support.toString(); // return support group as answer
} else {
if (category == 'security') {
return '71272132db10e01057e2e2d2ca96193f';
} else if (category == 'Cloud') {
return 'f5272132db10e01057e2e2d2ca961933';
} else if (category != '' && support == '') {
return '';
}
}
return 'false';
After adding the property its not setting the assignment group, please find below script.
CIAssignmentgroup: function(cmdb_ci) {
var security = gs.getProperty('Security.SOC.Assignment.Group.SysID');
var cloud = gs.getProperty('Cloud.Assignment.Group.SysID');
var SD = gs.getProperty('Service.Desk.Assignment.Group.SysID');
cmdb_ci = JSUtil.nil(cmdb_ci) ? this.getParameter("sysparm_cmdb_ci") : cmdb_ci; // Passing cmdb as parameter
var category = this.getParameter("sysparm_category").toString(); //Passing category as parameter
var gr = new GlideRecord("cmdb_ci");
gr.addEncodedQuery('sys_id=' + cmdb_ci + '^support_groupISNOTEMPTY');
gr.query();
gs.log("TR:cat " + category);
if (gr.next()) {
var support = gr.getValue("support_group"); //Getting the value of CI's support group
return support.toString(); // return support group as answer
} else {
if (category == 'security') {
return security;
} else if (category == 'Cloud') {
return cloud;
} else if (category != '' && support == '') {
return SD;
}
}
return 'false';
},
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
ā01-28-2022 04:18 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
ā01-28-2022 07:28 PM
Hi Joro,
Its not a scoped application. Just I replaced the sys id with the property. How i need to use the property in script include?
Regards,
Tejaswini RG

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
ā01-28-2022 08:03 PM
Hi,
Please use the appropriate forum feature "Insert/Edit code sample" when pasting code. This helps keep things organized and easier to read:
Other than that, please use log statements to help you troubleshoot, else you're just coding in the dark. Double-check your values and switch the one log statement I saw to gs.info() instead.
In your testing, what category did you see?
What does your other script show is being returned?
Considering changing these to this, just in case:
return security.toString();
Please mark reply as Helpful/Correct, if applicable. Thanks!
Please consider marking my reply as Helpful and/or Accept Solution, if applicable. Thanks!