Reference Qualifier Unique Values
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-14-2019 11:11 AM
Hello Community,
I have a Catalog item that currently has 3 Lookup Select boxes. The table they reference has 90k records. This is causing a performance issue. I need to convert at least 2 of them to Reference variables. The table that is being referenced has many safe keys to one group name. So for the end users I want them to only see the unique (distinct) Group name.
Here is the Script Include I've written, but it's not pulling back just the distinct sys_id. What am I missing?
var CyberarkGroups2 = Class.create();
CyberarkGroups2.prototype = {
initialize: function() {
},
getGrps: function() {
var gr = new GlideRecord('u_cyberark_data_integration1');
gr.addNotNullQuery('u_ad_group');
gr.orderBy('u_ad_group');
gr.query();
var filter='sys_idIN';
while (gr.next()){
filter += gr.sys_id + ','; //Gets all sys_ids for table u_cyberark_data_integration1
}
return filter;
},
type: 'CyberarkGroups2'
};
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-11-2020 09:18 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-12-2020 05:04 AM
yes, this requirement is achievable and I can help you with this requirement. please explain a little bit more.
thanks
hammad
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-13-2020 01:56 AM
Hi Hammad,
There are several databases under each application record. I have variable (reference type) referring to another table to fetch all applications. Similarlly,
I have a variable of type "List collector" on my record prodcuer. The requirements is to allow the user to select more than one values based on application selected. There are two more levels down the database, Category and Subcategory under each category.
Application A has Databases B and C.
Categroy B1, B2 under Database B, and Category C1, C2, C3 under Database C. Subcategories B1a,B1b under category B1, and just one subcategory under each category of Database B2. Likewise, just one subcategories C1a, C2a, C3a under C1, C2, C3 respectively.
So in total I have 6 records on the table, however just 2 database records. I need to show only those 2 unique Database records, however currently it shows 6 (B,B,B and C,C,C) for above combinations.
I am having below script include function doing little job on the server side (confirmed with logs), however i still can't get the results on the record producer variable on the portal.
findUnique:function(application)
{
gs.info('Here inside the Script Include function, application == ' + application);
var gr = new GlideRecord('u_key_fields_mapping');
gr.addEncodedQuery('u_application.sys_id=' + application);
gr.query();
var db = [];
while(gr.next()){
db.push(gr.getDisplayValue('u_database').toString());
}
var arrUtil = new ArrayUtil();
var dbUnique = [];
dbUnique = arrUtil.unique(db);
gs.info('Database rows (unique) == ' + dbUnique);
return dbUnique;
},
Please provide any help to get this regard.
Thanks,
Sagar
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-13-2020 03:47 AM
hi Sagar,
I got the whole structure of how the application, database, category and subcategories are linked.
what is the field type of database on u_key_fields_mapping table.?
thanks
Hammad
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-13-2020 03:53 PM
Its of type "Reference", referring to CMDB Database class/table.