How to script If a value has changed?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-20-2024 02:26 PM
I need an onSubmit Client Script but I also need it to check if the 'State' field value has changed.
How can this be scripted?
Thank you,
Susan
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-20-2024 05:44 PM
Hi @Su522 ,
Update script like below:
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?");
}
}
}
If I could help you with your Query then, please hit the Thumb Icon and mark it as Correct !!
Thanks & Regards,
Sumanth Meda
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-20-2024 05:56 PM
@Su522 - sorry I didn't get your question. You got the script working with the above but what are you asking here?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-20-2024 06:32 PM
Yes I got the script working with the code I posted.
I was asking if its possible to use a BR for a pop window for processing - Ok (proceed) or Cancel (abort the operation)
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-20-2024 06:37 PM
@Su522 - Since you are using a GlideModal, it wouldn't be a good user experience to use a BR. If you are using a BR, the validation will occur after the pop-up is closed and as the form is saving, it will throw an error.
But I would still recommend having a BR as the record can be updated in a different UI (e.g. list view).