g_form.addInfoMessage and errorMessage does not work in Workspace
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-27-2023 04:06 AM - edited 11-27-2023 04:07 AM
Hi Team,
I have configured a client script which shows info message and error message on native UI and does not show in Workspace. Any Idea?
I was suspecting that as it is asynchronous call, it does not wait for the call to complete and it skips the getResponse() function.
Any Idea is appreciated.
@Ankur Bawiskar : Please share your valuable responses.
function onLoad() {
if (g_form.getDisplayBox('recovery_time_objective').value != '') {
var ga = new GlideAjax('sn_bia.BIAEngine'); //Scriptinclude
ga.addParam('sysparm_name', 'conflictRTO'); //Method
ga.addParam('bpSysid', g_form.getUniqueValue()); //Parameters
ga.addParam('bpRTO', g_form.getDisplayBox('recovery_time_objective').value);
ga.getXMLAnswer(getResponse);
}
function getResponse(response) {
var res = JSON.parse(response);
if (res > 1) {
g_form.addErrorMessage('You have ' + res + ' dependent Business Process having Higher RTO.');
g_form.showFieldMsg('recovery_time_objective', 'The Estimated RTO conflicts to its more than one dependent Business Process. Please review it before you create a plan.', 'error');
}
if (res == 1) {
g_form.addErrorMessage('You have one dependent Business Process having Higher RTO.');
g_form.showFieldMsg('recovery_time_objective', 'The Estimated RTO conflicts with one of its dependent Business Process. Please review it before you create a plan.', 'error');
}
}
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-28-2023 12:45 PM
Hi Prasad,
You are correct. Even I suspected the same. But the line setCallback is not working.
I have replaced with your code. It doesnt work. May be setCallback method id deprecated method.
Any idea is appreciated.
Thanks.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-29-2023 01:44 PM
I can't get an errorMessage to not show in workspace onLoad. In the browser developer tools are you getting any related console errors? What does your Script Include look like?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-29-2023 08:08 PM - edited 11-29-2023 08:12 PM
Hi @PrakashRam
getDisplayBox will not work in Workspace. Inspect and open the Browser Console, you should see the error message.
If you'd like to retrieve the display value of a reference field in workspace, try to use getDisplayValue instead.
Or you can simply pass the field value and handle next steps in the conflictRTO function.
Cheers,
Tai Vu