Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-14-2021 11:42 PM
So to make your logic work do this
1) create hidden variable of type String and hide it always using UI policy on form load
2) whenever user selects Yes set the hidden variable with Yes
3) when user changes value from Yes clear it
4) now use this hidden variable value in your script for comparision
Script like this
function onChange(control, oldValue, newValue, isLoading, isTemplate) {
if (isLoading){
return;
}
if(newValue == 'Yes'){
g_form.setValue('hiddenVariable', 'Yes');
}
else if(newValue == 'No' || newValue == ''){
g_form.clearValue('hiddenVariable');
}
if(g_form.getValue('hiddenVariable') == 'Yes' && newValue == 'No'){
// your logic
}
}
Regards
Ankur
Regards,
Ankur
✨ Certified Technical Architect || ✨ 10x ServiceNow MVP || ✨ ServiceNow Community Leader
Ankur
✨ Certified Technical Architect || ✨ 10x ServiceNow MVP || ✨ ServiceNow Community Leader