How to generate a report showing users from specific group logins per month?

Praveena KKS
Tera Contributor

Hi All,

 

I'm trying to generate a report showing how many times users from a specific group logged into the ServiceNow portal over the course of a month. I need to run this report periodically. Any ideas or suggestions would be appreciated.

Thanks,
Praveena. K

3 REPLIES 3

SumanthDosapati
Mega Sage
Mega Sage

@Praveena KKS 

Check if any data is available in sp_log table which is Service Portal Logs Entries table.

However your requirement looks like a custom one and report might not be possible OOB.

 

Accept the solution and mark as helpful if it does, to benefit future readers.
Regards,
Sumanth

Ankur Bawiskar
Tera Patron
Tera Patron

@Praveena KKS 

for this you will have to check couple of system tables

This is not a straight forward requirement

If my response helped please mark it correct and close the thread so that it benefits future readers.

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader

Chaitanya ILCR
Kilo Patron

Hi @Praveena KKS ,

you can create a Database view between sys_audit and sys_user tables

ChaitanyaILCR_0-1747150892928.png

where class used

sa.documentkey=su.sys_id && sa.fieldname='last_login'

 

Create a Script include with Sandbox enabled true

ChaitanyaILCR_1-1747150996422.png

 

var GroupMemberUtils = Class.create();
GroupMemberUtils.prototype = {
    initialize: function() {},

    getGroupMembers: function(id) {
        var members = [];
        var grpMemGr = new GlideRecord('sys_user_grmember');
        grpMemGr.addEncodedQuery('group=' + id);
        grpMemGr.query();
        while (grpMemGr.next()) {
            members.push(grpMemGr.getValue('user'))
        }
        return members;

    },

    type: 'GroupMemberUtils'
};

create the report on DBV

ChaitanyaILCR_2-1747151143972.png

 

filter used

javascript:new GroupMemberUtils().getGroupMembers('Put SySID of your Group')

 

ChaitanyaILCR_3-1747151246706.png

 

You got the idea 

 

you can extend this as per your requirement

 

 

Please mark my answer as helpful/correct if it resolves your query.

Regards,
Chaitanya