- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-04-2023 05:09 AM - edited 05-04-2023 05:11 AM
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
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-04-2023 05:17 AM - edited 05-04-2023 05:18 AM
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.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-04-2023 05:45 AM
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
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-04-2023 06:06 AM - edited 05-04-2023 06:06 AM
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
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-04-2023 06:18 AM - edited 05-04-2023 06:20 AM
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