Make a field mandatory if incident is created from new call

Community Alums
Not applicable

Hi All,

I want to make 'contact number' field on incident form to mandatory when incident is created from New Call. And mandatory only on new record and if assignment group is Software. Can someone help me in achieving this functionality.

1 ACCEPTED SOLUTION

Pavankumar_1
Mega Patron

Hi @Community Alums ,

try below onchange client script on assignment group

function onChange(control, oldValue, newValue, isLoading, isTemplate) {
    if (isLoading || newValue === '') {
        return;
    }
    if (g_form.isNewRecord()) {
        if (newValue == 'b8ef24616fc331003b3c498f5d3ee434') { //add software group sysid
            g_form.setMandatory('contact_number', true); //give contact number backend name
        }
    }
}

Screenshot (612).png

If it helps please click Accept as Solution/hit the Thumb Icon.
ServiceNow Community MVP 2024.
Thanks,
Pavankumar

View solution in original post

10 REPLIES 10

Mayu
Tera Guru
Tera Guru

We  can write onchange clientscript for assignment group and check assignment group is software.

 

if(g_form.newRecord())

{

if(newValue=='software')

{

g_form.setMandetory('contact _number,true);

}

}

Please mark correct if it is helpful.