Based on CI assignment group needs to be populated in incident form
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-20-2022 11:38 PM
Hello,
Based on CI i have to populate the assignment group(not support or change group)
i have a group name separately if select CI(EX:- A or B or C) i have have to populate Assignment group as(ex:- test group) in case if i select a different CI apart of(A or B or C) then the group name and assigned to should no clear
Please check the below script and correct if there in any mistake please
right now working fine but when i create a new incident and if i change the ci then Assigned to value is cleaning that should not happen.
function onChange(control, oldValue, newValue, isLoading, isTemplate) {
if (isLoading || newValue === '') {
return;
}
var result = false;
var grp = g_scratchpad.formGroup;
var ci = [];
ci = g_scratchpad.CI.split(',');
var groupName = g_scratchpad.group;
var assit= g_scratchpad.assto;
for (var i = 0; i < ci.length; i++) {
if (newValue == ci[i]) {
result = true;
break;
}
}
if (result) {
g_form.setValue('assignment_group', groupName);
} else {
g_form.setValue('assignment_group', grp);
g_form.setValue('assigned_to',assit);
}
}
Business rule
(function executeRule(current, previous /*null when async*/) {
// Add your code here
g_scratchpad.CI = gs.getProperty("A B C");
g_scratchpad.group = gs.getProperty("test group");
g_scratchpad.formGroup=current.assignment_group;
g_scratchpad.assto=current.assigned_to;
})(current, previous);
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-21-2022 12:11 AM
Hi,
So what debugging did you perform?
Regards
Ankur
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-21-2022 12:20 AM
Hi,
I have check all the client scripts, bussiness rules i dont find anything related to this.
if i deactivated the script it is working fine(if i change the CI to any incident assignment group and assign to is not clearing)
if it is active then assign to is clearing when i change the CI
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-21-2022 12:21 AM
but I could not find any script which is clearing assigned to?
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-21-2022 12:57 AM
yes but assign to is clearing because of the script. if i deactivate the script it is working fine
is there any other way to achieve this requirement?