- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 weeks ago - last edited 3 weeks ago
Hello,
The requirement is to create a catalog item to remove the users from the groups. I have attached all the screen captures from PDI. Groups (that user is member of) need to populate only when user is selected;however, it is auto populating on its own. Any help would be gretly appreciated.
My Script include - When I used this SI in catalog client script it is working;however, as an advanced reference qualifier, it isn't.
var GetGroups = Class.create();
GetGroups.prototype = Object.extendsObject(AbstractAjaxProcessor, {
isPublic:function(){
return true;
},
getUsersGrp: function(user_id) {
var dataArr = [];
// var user_id = this.getParameter('sysparm_user_id');
var gr_Grp = new GlideRecord('sys_user_grmember');
gr_Grp.addQuery('user', user_id);
gr_Grp.query();
while (gr_Grp.next()) {
dataArr.push(gr_Grp.group.name.toString());
}
// return dataArr[0].groups_list.getDisplayValue();
// return dataArr[0].groups_list.toString();
// return JSON.stringify(dataArr);
return 'sys_idIN'+ dataArr.join(',');
},
type: 'GetGroups'
});
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
2 weeks ago
Hello @SathiskumarD
You are using user_id in addQuery but you didn't define any parameter in your script include function
define here
getUsersGrp: function (user_id)
also confirm that your variable name is correct which you are passing from reference qualifier
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
2 weeks ago
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 weeks ago
You might try setting the "Sandbox enabled" on your script include.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 weeks ago
No it doesn't work. I tried it just now.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 weeks ago - last edited 3 weeks ago
Hello @SathiskumarD
What is the need of script include here when you directly pass user, try this
javascript: 'user='+current.variables.user_to_be_removed.toString();
variable attributes: ref_auto_completer=AJAXTableCompleter,ref_ac_columns=group,ref_qual_elements=user_to_be_removed
and set group field display as true in table dictionary
catalog item
If you want to use script include, i think the issue in your script include function is that you are pushing name in array and returning sys_idIN
Either push sysids in array Or return groupIN
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 weeks ago
It is multi-tenant. i cannot change the "Display" just like that!I see the groups are populating by changing the display value but cannot recreate the same result with script include!And yes,I did change the code to pull group sysIDs instead of name.
