- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-11-2024 10:31 AM
Hello Everyone,
I want to populate all the assignment groups of user belong to in the catalog item.
variable - requested for - Sys user table
assignment groups - list collector - Sys user group table.
with logged in user I have got by using reference qualifier. Can anyone help me with the solution if I change requested for how can I get the list of assignment groups user is part of.
Thank you !! Your help is much appreciated!!
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-11-2024 11:51 AM - edited 03-11-2024 12:12 PM
Hi @Dileep2 ,
You can achieve this via OnChange Client script and script include ,
Key Point :
1. assignment groups - list collector - sys_user_grmember table. (make it read only so that no can change it)
2. Create client callable si
3. Please change the backend name according to your requirement
OnChange:
function onChange(control, oldValue, newValue, isLoading) {
if (isLoading || newValue == '') {
return;
}
var sysId = g_form.getValue('requested_for');
var ga = new GlideAjax('getRequestedForDetail');
ga.addParam('sysparm_name', 'getGroupDetail');
ga.addParam('sysparm_id', sysId);
ga.getXML(getResponse);
}
function getResponse(response) {
var ans = response.responseXML.documentElement.getAttribute('answer');
g_form.setValue('requested_for_assignment_group', ans);
}
}
Script Include:
var getRequestedForDetail = Class.create();
getRequestedForDetail.prototype = Object.extendsObject(AbstractAjaxProcessor, {
getGroupDetail: function() {
var sysID = this.getParameter('sysparm_id');
var gr = new GlideRecord('sys_user_grmember');
gr.addQuery('user',sysID);
gr.query();
var arr = [];
while (gr.next()) {
arr.push(gr.group.name.toString());
}
// gs.info('line number 15 ' + arr);
return arr.toString();
},
type: 'getRequestedForDetail'
});
Please mark this comment as Correct Answer/Helpful if it helped you.
Regards,
Swathi Sarang
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-13-2024 05:02 AM
Hello Swathi,
Found one issue.
Assignment groups are getting populated but after submitting the request, in the RITM the assignment group field is becoming empty. The field is getting cleared.
Could you please have a look into it
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-13-2024 05:40 AM
Hi @Dileep2 , you can make Applies on Requested item and applies on catalog task true in client script
Please mark this comment as Correct Answer/Helpful if it helped you.
Regards,
Swathi Sarang
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-13-2024 06:54 AM
Hello Swathi
Sorry its not working
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-13-2024 07:13 AM
@Dileep2 could you please share the screen shot of the issue ?