- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-20-2018 11:06 AM
I have an 'onChange' on the priority field, client script. When the priority is changed (record not yet saved) pops up as expected. When the user goes to 'Save / Update' the record, the pop up fires multiple times. This is not an onSubmit, so not understanding why? script below.
function onChange(control, oldValue, newValue, isLoading, isTemplate) {
if (oldValue != newValue) {
//Popup asking user to validate the priority change
if(!g_form.isNewRecord()){
alert('You are changing the priority from ' + 'P' + oldValue + ' to ' + 'P' + newValue + '. Please indicate in additional comments why the priority was changed and who approved.');
}
}
}
Solved! Go to Solution.
- Labels:
-
Best Practices
-
Scripting and Coding

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-14-2018 01:42 PM
That script works perfectly fine in my dev instance. Only fires on Priority change, never onLoad, or onSubmit. Are you sure the Priority change is being written to the dbase and something else isn't going on?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-20-2018 01:11 PM
I agree has to be, but I don't know what. This is only popup being used in this case. It's like my save/update function is recalculating the priority thus thinking it is "changed" again. I'm just not finding it.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-20-2018 05:08 PM
What if we change the script a bit like this:
function onChange(control, oldValue, newValue, isLoading, isTemplate) {
if (isLoading || g_form.isNewRecord()) {
return;
}
if (oldValue != newValue) {
//Popup asking user to validate the priority change
alert('You are changing the priority from ' + 'P' + oldValue + ' to ' + 'P' + newValue + '. Please indicate in additional comments why the priority was changed and who approved.');
}
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-22-2018 08:36 PM
I think that did it, gave it multiple attempts and only firing onchange only, no longer during save! Awesome. Thank you very much.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-14-2018 11:05 AM
I am finding these multiple erroneous alerts occur only if a change is made on both fields. I have two onchange client scripts, 1 for an onchange on my Priority field and another onchange client script for the Assignment group field.
The multiple alerts only occur if both priority is changed and then assignment group once the changes are saved/updated.
If individually updated, it does not loop. Just 1 alert message.
Any suggestion is appreciated.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-14-2018 11:12 AM
You have 2 onChange Client scripts both with alert that will generate a pop-up. If you change one field, you get one pop-up. Then change another field, another pop-up.
What are you trying to have happen?