Incident form

ServiceNow40
Tera Contributor

Incident form need to fill the mandatory details and save , but it's showing Invalid insert .

 

Example task : when the incident form two fields Assignment Group & Previous Group.

 

User select Assignment Group is "Service Desk "  save and again Assignment Group is "Analytics Settings Managers"  save it then automatically  Previous Group is "Service Desk" automatically populate .

 

Any idea help me.

2 REPLIES 2

Runjay Patel
Giga Sage

Hi @ServiceNow40 ,

 

You can write before update business rule.

RunjayPatel_0-1731483576139.png

 

RunjayPatel_1-1731483636505.png

 

code: 

current.u_previous_group = previous.assignment_group;

 

 

-------------------------------------------------------------------------

If you found my response helpful, please consider selecting "Accept as Solution" and marking it as "Helpful." This not only supports me but also benefits the community.


Regards
Runjay Patel - ServiceNow Solution Architect
YouTube: https://www.youtube.com/@RunjayP
LinkedIn: https://www.linkedin.com/in/runjay

-------------------------------------------------------------------------

Juhi Poddar
Kilo Patron

Hello @ServiceNow40 

 

Create an onchange client script:

  • Table: Incident
  • Type: onChange
  • Field Name: Assignment group
  • script:

 

function onChange(control, oldValue, newValue, isLoading, isTemplate) {
   if (isLoading || newValue === '') {
      return;
   }
   //Type appropriate comment here, and begin script below
   g_form.setValue('u_previous_assignment_group', oldValue); //set the previous assignment group
}​

 

On incident form:

  • A new variable 'Previous Assignment group' is created referencing table 'sys_user_group'

The proposed solution with set the "Previous assignment group" field with old value of "assignment group" when it changes.

 

"If you found my answer helpful, please like and mark it as the "accepted solution". It helps others find the solution more easily and supports the community!"

 

Thank You
Juhi Poddar