- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-12-2014 12:41 PM
Is is possible call a specific system properties category and then loop through the system properties to add an array list?
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-12-2014 05:01 PM
I think you want something like this, but no idea why:
var arr = [];
var m2m = new GlideRecord('sys_properties_category_m2m');
m2m.addQuery('category.name', 'NAME_OF_CATEGORY');
m2m.query();
while (m2m.next()) {
arr.push(m2m.property.name);
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-13-2014 11:58 PM
Yes . It is possible to store categories as comma separated value in a new property.
Create a new property.
Store categories in property value as comma separated.
Write a script include or UI script which will return the list of Categories as array.
Use the array where ever required.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-15-2014 01:30 PM
This is what I ended up using.
//Missing files during download
if ((email.subject.indexOf("Matches this subject") > -1))
{
var arr1 = [];
var m2m = new GlideRecord('sys_properties_category_m2m');
m2m.addQuery('category.name', 'ReplacewithCATEGORYNAME');
m2m.query();
while (m2m.next()) {
arr1.push(m2m.property.value);}
gs.log('checking array for values:');
for(var i=0,len=arr1.length;i!=len;i++) {
gs.log('sys prop from array: ' + arr1[i]); }
current.watch_list.setValue(arr1.join());
current.assignment_group.setDisplayValue('ReplacewithAssignmentGroup');
current.category = "network";
current.subcategory = "Auto-alert";
}