- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-29-2024 10:05 PM
Hi all,
I've just tried the below code.
the expected result is if we change category to Network/Hardware only the related fields shoul show up in assignment group but im not getting the solution.
here i've stored the sys_id's in properties & tried calling it in other codes where it worked.
Attaching a picture for dictionary override
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-29-2024 10:30 PM
I corrected that as well
You had dot between the 2 properties, I added comma since you are using IN operator and I assume each property holds 1 sysId
return 'sys_idIN' + gs.getProperty('getNetwork') + ',' + gs.getProperty('getNetworkCab');
If my response helped please mark it correct and close the thread so that it benefits future readers.
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-29-2024 10:15 PM
why to use JSON?
Simply update as this
var getGroupMember = Class.create();
getGroupMember.prototype = Object.extendsObject(AbstractAjaxProcessor, {
grpMember: function() {
var count = '';
var groupName = this.getParameter('sysparm_assignment_group');
var gr = new GlideRecord('sys_user_grmember');
gr.addQuery('group', groupName);
gr.query();
if (gr.next()) {
count = gr.getRowCount();
} else {
count = 'There are no Group Member';
}
return count;
},
assignMembers: function() {
var grMembers = [];
var groupID = this.getParameter('sysparm_group_name');
var gr = new GlideRecord('sys_user_grmember');
gr.addQuery('group', groupID);
gr.query();
while (gr.next()) {
grMembers.push(gr.getValue('user'));
}
return grMembers.toString();
},
showGroup: function(getCategory) {
if (getCategory == 'network') {
return 'sys_idIN' + gs.getProperty('getNetwork') + ',' + gs.getProperty('getNetworkCab');
} else if (getCategory == 'hardware') {
return 'sys_idIN' + gs.getProperty('getHardware');
}
},
type: 'getGroupMember'
});
If my response helped please mark it correct and close the thread so that it benefits future readers.
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-29-2024 10:21 PM
Thanks for the response.
this refers to only showGroup function. i haven't used JSON in that, it returns the sys_id of assignment group based on the category
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-29-2024 10:30 PM
I corrected that as well
You had dot between the 2 properties, I added comma since you are using IN operator and I assume each property holds 1 sysId
return 'sys_idIN' + gs.getProperty('getNetwork') + ',' + gs.getProperty('getNetworkCab');
If my response helped please mark it correct and close the thread so that it benefits future readers.
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-29-2024 10:44 PM