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

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.

Hello @Prince Arora  Thanks for the reply,

 

The value is again reverting to the referred value form the Service field.

only when service is removed  we are able to save the new assignment group

 

Regards

Karan

 

@Kaustubh k 

 

could you please explain it once more as it is confusing to understand

1) You have selected a service and it has automatically populate the 4 fields including assignment group

2) Now user has changed the assignment group manually and save the form and it has been saved successfully.

 

what's the next step?

 

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

Hello @Prince Arora , It worked all good now with the same changes to the script.

Thanks much for help !!

Regards

Karan