Need to change Assignment group for selected records from Actions on selected Records

Abdul
Tera Contributor

i would like to change assignment group in bulk for a custom table when the user selects the record from the list view and selects the option from action on selected records dropdown. when the click that an option to change the assignment group in bulk should appear when the user selects that a pop up window should appear and on that the user should be able to select the groups from sys_user_group table and update the record.

 

 

I wrote this code for ui action :

function changeAssignmentGroup() {
    var selSysIds = g_list.getChecked();
    var dialogClass = typeof GlideModal != 'undefined' ? GlideModal : GlideDialogWindow;
    var dlg = new dialogClass('change_assignment_group_dialog');
    dlg.setTitle("Change Assignment Group");
    dlg.setPreference('sysparm_checked_sys_ids', selSysIds);
    dlg.setPreference('sysparm_table', g_list.getTableName());
    dlg.setPreference('focusTrap', true);
    dlg.render();
}
 
i have created the ui page as well:
<?xml version="1.0" encoding="utf-8" ?>
<j:jelly trim="false" xmlns:j="jelly:core" xmlns:g="glide" xmlns:j2="null" xmlns:g2="null">
<g:ui_form>
  <div style="padding: 20px;">
    <label for="assignment_group">Select Assignment Group:</label><br/>
    <input type="hidden" id="sys_ids" value="${sysparm_checked_sys_ids}"/>
    <input type="hidden" id="table" value="${sysparm_table}"/>

    <g:reference name="assignment_group" id="assignment_group" table="sys_user_group" />
    <br/><br/>
    <button class="btn btn-primary" onclick="submitChange()">Update</button>
    <button class="btn btn-default" onclick="GlideDialogWindow.get().destroy()">Cancel</button>
  </div>
</g:ui_form>

</j:jelly>
 
But when i click the option on the action on selected records, the window is not appearing can you please help
1 ACCEPTED SOLUTION

Ankur Bawiskar
Tera Patron
Tera Patron

@Abdul 

why are you not using the Update selected OOTB feature?

1) select the records and right click -> Update selected

AnkurBawiskar_0-1746621671651.png

 

2) Then give the Group you want

AnkurBawiskar_1-1746621702410.png

 

3) Click Update on top right

It updates the 3 records I selected

AnkurBawiskar_2-1746621757097.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

View solution in original post

1 REPLY 1

Ankur Bawiskar
Tera Patron
Tera Patron

@Abdul 

why are you not using the Update selected OOTB feature?

1) select the records and right click -> Update selected

AnkurBawiskar_0-1746621671651.png

 

2) Then give the Group you want

AnkurBawiskar_1-1746621702410.png

 

3) Click Update on top right

It updates the 3 records I selected

AnkurBawiskar_2-1746621757097.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