Late response form getMessage in client script
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-12-2024 12:29 PM
Hi All,
We have implemented the catalog client script for the Portal, intending to display an alert message to users when they click on the "Add" button in MVRS. However, due to the delayed response from fetching messages (which involves hundreds of records in the translation table sys_ui_message), we anticipate that when a user clicks on the "Add" button, the alert should promptly appear, and upon the user clicking "OK," it should proceed to submit the MVRS.
function onChange(control, oldValue, newValue, isLoading) {
if (isLoading || newValue === '') {
return;
}
var info = "Please check test”;
getMessage(info, function(msg) {
alert(msg);
// Once the alert is acknowledged, proceed with further actions
processForm();
});
function processForm() {
var orderval = g_form.getValue(‘test’);
var ga = new GlideAjax('Customer');
ga.addParam('sysparm_name', 'gettest’);
ga.addParam('order', orderval);
ga.getXML(function(response) {
var answer = response.responseXML.documentElement.getAttribute('answer');
g_form.setValue('total', answer);
g_form.submit();
});
}
}
Please guide me with best practices