Alert message onChange Client Script
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-07-2017 06:41 AM
Hi all,
I could use some help with what I'm trying to accomplish. I'm trying to create an alert message when the disposition is set to cancelled. Ideally I would like to have the alert message show onChange but I would like a cancel option on the alert message and then have the values return back to what they were before.
Here is my code so far:
function onChange(control, oldValue, newValue, isLoading, isTemplate) {
if (isLoading || newValue === '') {
return;
}
//Alert message if dispostion changes
if (oldValue != newValue)
alert('You changed the disposition to ' + newValue + '. Cancelling this Demand item will cancel all associated tasks as well. Are you sure you want to continue?');
g_form.setValue('cancelled', oldValue);
}
This is a client script, onChange
Thank you in advance!
- Labels:
-
Best Practices
-
Scripting and Coding
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-07-2017 07:26 AM
Thanks Ujjawal!
I'm having trouble returning the old values when cancel is selected. I need to be able to return the previous value of the state and sometimes the disposition.