- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-30-2022 06:44 AM
var redirect_msg = getMessage('redirect_popup', function(msg) {});
if (confirm(redirect_msg) == true) {
top.window.open('some link to redirect');
return true;
} else {
return false;
}
In the above line of code, onSubmit of client script, confirm method is printing 'redirect_popup' in the popup message in the first attempt.
Until then, in the second attempt, getMessage gets value of 'redirect_popup' and prints the same in the confirm method.
How can I deal with getMessage so that I can get the message in first attempt.
Solved! Go to Solution.
- Labels:
-
Service Catalog

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-30-2022 11:53 PM
try the below:
function onSubmit() {
if (g_scratchpad.isFormValid){
return true;
}
var actionName = g_form.getActionName();
var redirect_msg = getMessage('redirect_popup', function(msg) {
if (confirm(msg) == true) {
top.window.open('some link to redirect');
g_scratchpad.isFormValid = true;
g_form.submit(actionName);
} else {
return false;
}
});
return false;
}
it may not work as I have not tested it, but this should be the general idea: first you execute the callback function and immediately after that stop saving the form, then when the callback executes, if user confirms, you trigger saving of the form again, if the user declines, basically do nothing.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-30-2022 11:53 PM
try the below:
function onSubmit() {
if (g_scratchpad.isFormValid){
return true;
}
var actionName = g_form.getActionName();
var redirect_msg = getMessage('redirect_popup', function(msg) {
if (confirm(msg) == true) {
top.window.open('some link to redirect');
g_scratchpad.isFormValid = true;
g_form.submit(actionName);
} else {
return false;
}
});
return false;
}
it may not work as I have not tested it, but this should be the general idea: first you execute the callback function and immediately after that stop saving the form, then when the callback executes, if user confirms, you trigger saving of the form again, if the user declines, basically do nothing.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-01-2022 02:28 AM
Hi
I have tested the solution and its working fine.
Thank You.