- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-19-2024 02:39 AM
Hi!
I would like to make sure that if user changes >>assignment group<< to a different one, the >>Assigned to<< field is cleared out. Like this we are sure that only ppl from the assignment group can be assigned to the task.
Shall I use business rule to solve this?
thanks!
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-19-2024 03:33 AM - edited 04-19-2024 03:35 AM
Hi @dev_K ,
I checked there is one OOB client script working on assignment group works on ONLOAD Firstly you can check your instance if this client script present or not, if not you can add that name "Empty assigned_to on group change"
You can create one client script and add below code
function onChange(control, oldValue, newValue, isLoading, isTemplate) {
if (isLoading)
return;
// Need to get the form value, in case it changes but then changes back to value in database (oldValue is always DB value)
if (oldValue != newValue)
g_scratchpad.formValue = newValue;
if (newValue === '' || newValue == null || oldValue != newValue || newValue != g_scratchpad.formValue) {
if(newValue && g_form.getValue("assigned_to")){
var groupLookupGr = new GlideRecord('sys_user_grmember');
groupLookupGr.addQuery('group.sys_id', newValue);
groupLookupGr.addQuery('user', g_form.getValue("assigned_to"));
groupLookupGr.setLimit(1);
groupLookupGr.query(groupLookupCallback);
} else {
g_form.setValue("assigned_to", "");
}
}
}
function groupLookupCallback(groupLookupGr){
if (!groupLookupGr.hasNext())
g_form.setValue("assigned_to", "");
}
Please refer below image
Please mark my answer correct and helpful if this works for you
Thanks and Regards
Sarthak
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-19-2024 02:43 AM
Hi @dev_K
It is OOTB available , i just tested. When i change the Assignment group, assigned to field get empty.
If my response proves useful, please indicate its helpfulness by selecting " Accept as Solution" and " Helpful." This action benefits both the community and me.
Regards
Dr. Atul G. - Learn N Grow Together
ServiceNow Techno - Functional Trainer
LinkedIn: https://www.linkedin.com/in/dratulgrover
YouTube: https://www.youtube.com/@LearnNGrowTogetherwithAtulG
Topmate: https://topmate.io/atul_grover_lng [ Connect for 1-1 Session]
****************************************************************************************************************
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-19-2024 02:45 AM
I tested as well, in my instance it is not case and just received an incident regarding this issue.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-19-2024 02:47 AM
Hi @dev_K
Then check is any configuration changes done , you can use the client script onchange.
If my response proves useful, please indicate its helpfulness by selecting " Accept as Solution" and " Helpful." This action benefits both the community and me.
Regards
Dr. Atul G. - Learn N Grow Together
ServiceNow Techno - Functional Trainer
LinkedIn: https://www.linkedin.com/in/dratulgrover
YouTube: https://www.youtube.com/@LearnNGrowTogetherwithAtulG
Topmate: https://topmate.io/atul_grover_lng [ Connect for 1-1 Session]
****************************************************************************************************************
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-19-2024 03:06 AM
any ideas why this does not work? when i change the assignment group, the assigned to remains the same