- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-21-2023 02:59 AM
Hello Experts,
My requirement is
There is group called ABC group. In this group I want to check how many members are not authors for knowledge articles. We can check authors in this sn_km_mr_st_kb_knowledge table.
we can find that users manually but here I want to create a report based on above requirement.
How to achieve this...?
Thanks in advance.
Best Regards,
Raj
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-21-2023 06:15 AM
@raj149 ,
You can try below script
var grMembers = new GlideRecord('sys_user_grmember');
grMembers.addQuery('group', abcGroupId);
grMembers.query();
var nonAuthorsCount = 0;
while (grMembers.next()) {
var userId = grMembers.user.toString();
var grKnowledge = new GlideRecord('sn_km_mr_st_kb_knowledge');
grKnowledge.addQuery('author', userId);
grKnowledge.query();
if (!grKnowledge.next()) {
nonAuthorsCount++;
}
}
gs.print('Number of members in ABC group who are not authors: ' + nonAuthorsCount);
Was this answer helpful?
Please consider marking it correct or helpful.
Your feedback helps us improve!
Thank you!
Regards,
Amit Gujrathi
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-21-2023 06:07 AM
Hello @Amit Gujarathi
I really don't know about script now am learning.
Could you please help me here that will helpful for me.
Best regards,
Raj.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-21-2023 06:15 AM
@raj149 ,
You can try below script
var grMembers = new GlideRecord('sys_user_grmember');
grMembers.addQuery('group', abcGroupId);
grMembers.query();
var nonAuthorsCount = 0;
while (grMembers.next()) {
var userId = grMembers.user.toString();
var grKnowledge = new GlideRecord('sn_km_mr_st_kb_knowledge');
grKnowledge.addQuery('author', userId);
grKnowledge.query();
if (!grKnowledge.next()) {
nonAuthorsCount++;
}
}
gs.print('Number of members in ABC group who are not authors: ' + nonAuthorsCount);
Was this answer helpful?
Please consider marking it correct or helpful.
Your feedback helps us improve!
Thank you!
Regards,
Amit Gujrathi
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-21-2023 06:23 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-21-2023 06:28 AM
Please refer the video I have shared
Was this answer helpful?
Please consider marking it correct or helpful.
Your feedback helps us improve!
Thank you!
Regards,
Amit Gujrathi
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-21-2023 07:15 AM
Hello @Amit Gujarathi
I am your new subscriber from today(LOL)
Tested with below script include but it is not working
Best Regards,
Raj