while getting the multiple sysid from system property returning undefined in script include
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-19-2024 07:04 AM - edited 09-19-2024 07:25 AM
Hi,
while getting the multiple sysid's from system property returning undefined in logs from script include.
system property is given in comma separated value.
ex: bbdcc1cd97c6a253afc8,fd0d8141907aa253afb4,7e4dc54597b253af37,4er5ty678793rdf36
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-19-2024 07:08 AM
Hi @krishna761,
Have you already define the system property "ITSM_SD_Groups"? If not yet, please define it in the sys_properties table.
Otherwise, please attach your existing code.
Thanks
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-19-2024 07:09 AM
How are you placing the sys ids in system property?
if it is in obj format then you need to use JSON.parse(gs.getProperty())
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-19-2024 07:22 AM
Hi,
comma separated
ex: bbdcc1cd97c6a253afc8,fd0d8141907aa253afb4,7e4dc54597b253af37,4er5ty678793rdf36
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-19-2024 07:26 AM
can you use this kind of code for your scenario and try:
var getGrp = gs.getProperty('ITSM_SD_Groups');
var spl = getGrp.split(',');
for (var i = 0; i < spl.length; i++){
var gr = new GlideRecord('sys_user_grmember');
gr.addQuery('group',spl[i]);
gr.query();
while(gr.next()){
gs.print(gr.user.getDisplayValue());
}
}