Assignment group Auto-populate based on the caller's assigned groups

NishaB
Tera Expert

Hi,

 

When I'm creating an incident record, I want the Assignment based on the logged in users Assignment group. I want the assignment group to auto-populate based on the logged-in user's or caller's assignment group. If there are multiple groups, it will show all groups available for selection in the alphabetical order. How to do this?

12 REPLIES 12

Yes you do. You can go to the people giving you this requirement and explain them that the requirement doesn't make sense. If you can't explain that to them, you don't have a grasp on the requirement and you are just doing what they tell you, which is the worst possible way of developing on the platform.

You are the person that needs to protect the platform/process owners from making mistakes. And this is a huge one.


Please mark any helpful or correct solutions as such. That helps others find their solutions.
Mark

Shivambitanwar1
Tera Contributor

Hi Nisha,

 

I agree with the people in this forum. As per ITIL best practises , this requirement is not making sense . There is no harm in asking questions that clarifies the requirement . It would make more sense if the assignment group are based on user's location.

 

//Shivambi

Runjay Patel
Giga Sage

Hi @NishaB ,

 

You can use reference qualifier to call script include which will return list of sysids which belongs to logged in user.

 

I have written code which will return groups based on logged in user you can pass the caller to script include to get the group.

 

Reference qualifier: 

javascript:"sys_idIN"+ new global.getMyGroup().getAllGroup();

 

Script include:

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

    getAllGroup: function() {
        var currentUserId = gs.getUserID();
        var groupSysIds = [];
        var gr = new GlideRecord('sys_user_grmember');
        gr.addQuery('user', currentUserId);
        gr.query();
        while (gr.next()) {
            groupSysIds.push(gr.group.toString());
        }

        return groupSysIds;
    },



    type: 'getMyGroup'
};

 

Result:

RunjayPatel_0-1737990581534.png

 

-------------------------------------------------------------------------

If you found my response helpful, please consider selecting "Accept as Solution" and marking it as "Helpful." This not only supports me but also benefits the community.


Regards
Runjay Patel - ServiceNow Solution Architect
YouTube: https://www.youtube.com/@RunjayP
LinkedIn: https://www.linkedin.com/in/runjay

-------------------------------------------------------------------------

 

 

 

In this video i have explained about Web service integration in ServiceNow like how it works, how we can configure it, what are the prerequisite and many more. I have covered below topics in this video. 1. understand Web Service. Like when and how we will use it. 2. Talked about Inbound and ...