- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-31-2022 05:02 AM
HI,
I have a onsumit client script on a form, when a value of a field changes I need to check if the value is same as another field and if so, do a confirm popup.
Can someone help with this please.
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-31-2022 08:09 AM
Hi,
update as this
function onSubmit() {
var subjectPersonValue = g_form.getValue('subject_person');
var openedForValue = g_form.getValue('opened_for');
var openedFor = g_form.getControl('opened_for');
if(openedFor.changed){
if (subjectPersonValue == openedForValue) {
confirm("You have set the Opened For to the Subject Person, which will grant them access to view the Case - are you sure?");
}
}
}
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
‎03-31-2022 05:04 AM
Hi,
so what's not working? where are you stuck?
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
‎03-31-2022 05:14 AM
not sure how to check if a certain variable has changed and if changed if it is same as another variable.
can you provide example please
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-31-2022 05:57 AM
Hi,
changed from what?
it's a new catalog form and if the value is empty on form load you can check with value != ''
it means value is given by user
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
‎03-31-2022 05:59 AM
so not new form, existing HR case form view. not catalog form.
When value on opened for changes, and if the value for opened for is same as subject person, then there should be confirm popup.