Change the value of Assignment group

Kaustubh k
Tera Contributor

Hello All,

 

We have created a reference field on the incident form: Service pointing to table categories which has fields like category, subcategory 1 and subcategory 2  and Assignment group and then based on the service we are setting the  related fields on incident form

function onChange(control, oldValue, newValue, isLoading) {
if (isLoading || newValue == '') {
return;
}
var test123 = g_form.getReference('u_service', populateUserInfo);

function populateUserInfo(usr) {

g_form.setValue('category', usr.u_category);
g_form.setValue('subcategory', usr.u_subcategory_1);
g_form.setValue('u_subcategory', usr.u_subcategory_2);
g_form.setValue('assignment_group', usr.u_assignment_group);
}
}

 

which works fine and all the fields are mapped on the form, even the assignment group but when we try to change the assignment group and submit the form its taking back to the mapped assignment group,

we want that user can even change the assignment group and submit and new group and save the record.

 

Please help with a review and revert for any suggestions

 

Thanks

Karan 

1 ACCEPTED SOLUTION

Prince Arora
Tera Sage
Tera Sage

@Kaustubh k 

 

Can you try to update the script as below:

 

function onChange(control, oldValue, newValue, isLoading) {
if (isLoading || newValue == '') {
return;
}
if(oldValue!=newValue){
var test123 = g_form.getReference('u_service', populateUserInfo);

function populateUserInfo(usr) {

g_form.setValue('category', usr.u_category);
g_form.setValue('subcategory', usr.u_subcategory_1);
g_form.setValue('u_subcategory', usr.u_subcategory_2);
g_form.setValue('assignment_group', usr.u_assignment_group);
}

}
}

 

If my answer solved your issue, please mark my answer as Correct & 👍Helpful based on the Impact.

View solution in original post

7 REPLIES 7

Steven Parker
Giga Sage

Are there any Assignment Lookup Rules in the instance that are setting the Assignment Group based on the categories chosen for the Incident?  I've had those override scripts at times causing confusion.


Please mark this response as correct and/or helpful if it assisted you with your question.
Steven

Hello Stevan,

The Assignment group is auto setting based on the service selection as it has assignment group mapping.

but, if should be able to change and save any other assignment group entries other than set and then save.

 

Regards

Karan

 

 

Looking at your call back script, shouldn't it be like this?  Test123 should be usr right?  I changed it below

 

 

if (isLoading || newValue == '') {
return;
}
//Commented out var test123 line
//var test123 = g_form.getReference('u_service', populateUserInfo);
var usr = g_form.getReference('u_service', populateUserInfo);

function populateUserInfo(usr) {

g_form.setValue('category', usr.u_category);
g_form.setValue('subcategory', usr.u_subcategory_1);
g_form.setValue('u_subcategory', usr.u_subcategory_2);
g_form.setValue('assignment_group', usr.u_assignment_group);
}
}

 

 


Please mark this response as correct and/or helpful if it assisted you with your question.
Steven