I want to restrict the Assign group based on COE for assigned to user

kumaar
Tera Contributor

So when the assigned to used comes to the case then he shout only see the groups based on coe

For example

If the Case is of hr benefits case and assignment group realted to this are D, A and C

Then he can only see these 3 groups to select.

I have written a Script include and Called it via Reference qualifier

My script is not working it seems

7 REPLIES 7

@kumaar  javascript:GetAllowedAssignmentGroups.getGroups(current.u_coe)

Let me try

Ankur Bawiskar
Tera Patron
Tera Patron

@kumaar 

Ideally HR cases are not to be created directly at core HR Case table but should be on the COE tables.

this should work

Script Include:

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

    getGroups: function(coe) {
        var coeGroups = {
            'sn_hr_core_case_benefits': ['TMC_HR_Tier1', 'TMC_HR_TIER1_MANAGERS', 'TMC_EXEC_SUPPORT'],
            'sn_hr_core_case_total_rewards': ['TMC_HR_Tier1', 'TMC_HR_TIER1_MANAGERS', 'TMC_EXEC_SUPPORT', 'TMC_WELL_BEING_TIER3']
        };

        var groups = coeGroups[coe] || [];
        return groups.length > 0 ? 'nameIN' + groups.join(',') : '';
    },

    type: "GetAllowedAssignmentGroups"
};

Ref qualifier as this -> dot walk to hr_service.service_table and pass that value

1) Remember the Assignment group field is at task level

2) so you will have to create dictionary override for HR Case table and then add the ref qualifier

AnkurBawiskar_0-1743752322822.png

AnkurBawiskar_1-1743752370589.png

 

javascript: new GetAllowedAssignmentGroups().getGroups(current.hr_service.service_table.toString());

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