Auto-populate assignment groups in the recent selections of the logged-in user

NishaB
Tera Expert

Hi ,

I've logged in to the system and I'm creating an incident record. If I click on the assignment group , I want the assignment groups in which the logged-in user is a member to be listed in the recent selections. I will attach the screenshot here. I want the assignment groups of the logged-in user to be in the recent selections? Is it do-able? Does it require more customizations?

4 REPLIES 4

NishaB
Tera Expert

Only the change has to be done in the recent selections. Not in the lookup list.

@NishaB 

what do you mean by recent selections?

You can create dictionary override for assignment_group field as it's on task and then show the groups to which logged in user belongs

something like this in dictionary override for incident table

javascript: 'sys_idIN' + new global.ArrayUtil().convertArray(gs.getUser().getMyGroups());

AnkurBawiskar_0-1738218286860.png

 

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

priyatam_pvp
Tera Guru

1️⃣ Create a Script Include (Server-side)

•Fetch all assignment groups where the logged-in user is a member.

•Return the list of group sys_ids.

 

2️⃣ Create an onLoad Client Script (Client-side)

•Call the Script Include to get the list of groups.

•Loop through each group and check if it already exists in Recent Selections.

•If not present, insert it into the sys_ui_recent_selection table.

 

3️⃣ Expected Outcome:

•When the user clicks on the Assignment Group field, they will see only the groups they are part of in the Recent Selections dropdown.

Let me know if the approach is suitable for your requirement. I can provide the code

Can you provide the code