- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-22-2021 04:56 AM
Hi all,
I have the following requirement:
1) If a users selects P1 or P2 as the incident priority the user is alerted with a pop-up that asks the user to confirm if they want to propse a MI
2) If the user selects continue the Propose a MI workflow is initiated.
So the confirm should only popup if the priority field CHANGES to 1 or 2, and not if it already is 1 or 2.
I have tried using the following onChange client script but does not work.
function onSubmit() {
var priority = g_form.getValue('priority');
if (priority == 1 || priority == 2) {
var response = confirm('Priority 1 & 2 tickets follow the major incident process. Please confirm that you would like to propose this ticket as a Major Incident.');
if (response == true){
gsftSubmit(null, g_form.getFormElement(), 'sysverb_mim_propose'); //MUST call the 'Action name' set in this UI Action
} else {
// If cancel is pressed or the dialog is closed the response is empty
return false;
}
}
}
the confirm function works and it pops up but the UI action does not trigger.
Please advise.
Solved! Go to Solution.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-03-2021 07:04 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-03-2021 07:02 AM
yes I added alerts and they all seem to come through.
function onSubmit() {
var priority = g_form.getValue('priority');
if (priority == 1 || priority == 2) {
alert("test inside first if");
var response = confirm('Priority 1 & 2 tickets follow the major incident process.
Please confirm that you would like to propose this ticket as a Major Incident.');
alert("test between ifs");
// If cancel is pressed or the dialog is closed the response is empty
if (response == true){
alert("test inside second if");
gsftSubmit(null, g_form.getFormElement(), 'sysverb_mim_propose'); //MUST call the 'Action name' set in this UI Action
alert("test after gsftsubmit");
} else {
return false;
}
}
}

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-03-2021 07:04 AM
Can you switch this to onChange?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-03-2021 07:08 AM
sure, i can try that, also i have noticed that the alert box pops up a few times concurrently.
so i get the first alert, then the popup, then second alert, then first alert again, then popup and second alert.
then after it gets to 3rd and 4th alert.
so its going in kind of loop.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-03-2021 07:13 AM
yes, thats why suggesting to use onChange,
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-03-2021 07:20 AM
okay that works! the UI action is now being triggered,
although it still triggers if the MI has already been proposed.
so for example I changed the priority to 1 and got prompted, i said OK and it proposed MI.
then I changed priority to 2, and it prompted again to propose MI, when I clicked OK got message, action not authorised.
How can I add logic to the script so it doesnt prompt if it has already been proposed as MI, and if the priority is already 1 or 2?