script not working to assigned incident in sow creating by servicedesk

Cherly
Tera Contributor

 i created this script i want the assignment group to be the servicenow group is a person is a member of the servicenow group this is in SOW. but this wont work

function onLoad() {
    // Check if the form is new (insert mode)
    if (g_form.isNewRecord()) {
        // Check if the user has the 'servicedesk' role
        if (g_user.hasRole('service_desk')) {
            // Set Assignment Group to sd_servicedesk (use sys_id)
            g_form.setValue('assignment_group', '0963cdc8d09d0d80f9f07225f7aca5ce'); // Replace with actual sys_id
        }
    }
}
1 REPLY 1

Brad Bowman
Kilo Patron
Kilo Patron

Ensure the UI Type = All

BradBowman_0-1765565779680.png

and the View includes 'sow'

BradBowman_1-1765565804610.png