Error in Incident form while applying UI policy

Abhi_007
Kilo Guru

Hi Team, 

We have an assignment where we have to auto populate the assignment group as per the service offering select by users but there is catch where we have to auto populate a default assignment group(for example : level 1) where the service Offering doesn't have any support group attached to it.

I have tried to implement UI policy by following condition along with script but while loading it in Incident form everything is working but the assignment group is not changing to deafult group as mentioned above rather it throws an error : onChange script error: RangeError: Maximum call stack size exceeded function () { [native code] }

1 ACCEPTED SOLUTION

Hi @Abhi_007 ,

 

Check the below code for onChange client script , this code will trigger onChange service field and get the group information from "cmdb_ci_service" table [ used column : Manage by group ] and set on incident form, the default group sys_id given ( you can change with correct sys_id );

 

function onChange(control, oldValue, newValue, isLoading, isTemplate) {
   if (isLoading || newValue === '') {
      return;
   }
   //Type appropriate comment here, and begin script below
   // get the reference object of selected service on incident form
   var group = g_form.getReference("business_service");
   
   if(group.managed_by_group != ''){
	g_form.setValue("assignment_group",group.managed_by_group); // group coming from cmdb_ci_service table
   } else {
	g_form.setValue("assignment_group", 'd625dccec0a8016700a222a0f7900d06'); // sys_id of default group
   }
}

AshishKMishra_0-1699988495848.png

This code is working perfectly on my PDI.

 

Service & Assignment Group, both are not mandatory OOTB but you have use case for "mandatory" assignment group on "State" change to resolved when "Assigned to" not empty then write the separate client script to validate it,  don't mix two separate dependencies on "Service" column. 

 

-Thanks

AshishKMishra

 


Please mark this response as correct and helpful if it helps you can mark more that one reply as accepted solution

View solution in original post

13 REPLIES 13

AshishKM
Kilo Patron
Kilo Patron

Hi @Abhi_007 ,

Seems like some kind of recursion going on with assignment field, please share the code you have written for default assignment.

 

-Thanks,

AshishKMishra


Please mark this response as correct and helpful if it helps you can mark more that one reply as accepted solution

Abhi_007_0-1699978344269.png

 

What’s UI policy condition for true / false decision which field you are checking.


Please mark this response as correct and helpful if it helps you can mark more that one reply as accepted solution

Abhi_007_0-1699979694439.png