in client script>> Onchange

nagarjunadn
Tera Contributor

Hi to all,

I need answer, here my question is

in client script>> Onchange  on incident form

Q). if category is 'network' then assignment group has to auto populate as network group? 

 

 

2 REPLIES 2

Pradeep Thipani
Mega Sage

Hi @nagarjunadn ,

 

Can you try by using Assignment lookup rule to populate group based on category? 

Navigate to-> Assignment lookup rules under System policy.Table:  dl_u_assignment

PradeepThipani_0-1732772924625.png

 

 

Sample OnChange script: 

 

  • Type: onChange
  • Table: Incident
  • Field: category

 

 

function onChange(control, oldValue, newValue, isLoading) {
    // Ensure this runs only when the category is changed and not during form loading
    if (isLoading) return;

    // Check if the category is "Network"
    if (newValue == 'Network') {
        // Set the assignment group to the network group
        g_form.setValue('assignment_group', 'Network Group Sys ID');
    }
}

 

 

Thanks,

Pradeep

 

 

 

"If this response was useful, please select 'Accept as Solution' and mark it as 'Helpful.' This helps me provide better answers and assists the community ".

Regards,
Pradeep

PrashantLearnIT
Giga Sage

Hi @nagarjunadn 

 

Please Use Assignment Lookup rules to set assignment group based on category.

********************************************************************************************************
Please appreciate the efforts of community contributors by marking the appropriate response as the correct answer and helpful. This may help other community users to follow the correct solution in the future.

********************************************************************************************************
Cheers,
Prashant Kumar
ServiceNow Technical Architect


Community Profile LinkedIn YouTube Medium TopMate
********************************************************************************************************