Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-05-2025 03:06 AM
that's expected. try this
function onChange(control, oldValue, newValue, isLoading) {
if (isLoading) {
return;
}
// Define the states that require clearing the "Assigned to" field
var clearStates = ['6', '9', '2'];
// Check if the new state is one of the states that require clearing the "Assigned to" field
if (clearStates.includes(newValue)) {
g_form.clearValue('assigned_to');
} else {
// If the state is not one of the clear states, retain the old value
var oldAssignedTo = g_form.getValue('assigned_to');
g_form.setValue('assigned_to', oldAssignedTo);
}
}
If my response helped please mark it correct and close the thread so that it benefits future readers.
Regards,
Ankur
✨ Certified Technical Architect || ✨ 10x ServiceNow MVP || ✨ ServiceNow Community Leader
Ankur
✨ Certified Technical Architect || ✨ 10x ServiceNow MVP || ✨ ServiceNow Community Leader