- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-30-2018 11:53 PM
I have an onSubmit script that is running a GlideAjax to enforce attachments for a record producer in Service Portal.
I'm getting a warning in the console for the getMessage that synchronous use not supported in Mobile or Service Portal unless message is already cached. How do I cache the message? One strange behavior is that the first time the submit button is clicked (and there are no attachments), the alert displays the "key", not the Message. But then every click on Submit after that correctly displays the Message, but throws Javascript errors.
I'm also getting the "Unhandled exception in GlideAjax" error. My script is below, anyone see the issue? Thanks!
Here's my onSubmit script
function onSubmit() {
var cat_id1 = g_form.getUniqueValue('sysparm_item_guid');
var survey = new GlideAjax('NominationUtil');
survey.addParam('sysparm_name','mandateAttachment');
survey.addParam('sysparm_cart_id',cat_id1);
survey.getXML();/
var answer =survey.getAnswer();
alert('answer is '+answer);//if no attachments, alert says "answer is null"
if(g_form.getValue('u_do_survey_target_employees_in_germany')=='yes'){
if((answer>=0 && answer<3)){
alert(getMessage('DP - survey target employees in germany - yes'));//this is "key" field of the message record
return false;
}
}
if(g_form.getValue('u_do_survey_target_employees_in_germany')=='no'){
if(answer>=0 && answer<2) {
alert(getMessage('DP - survey target employees in germany - no'));//this is "key" field of the message record
return false;
}
else if(answer==2){
return true;
}
else{
alert(getMessage('DP - survey target employees in germany - yes'));//this is "key" field of the message record
return false;
}
}
}
Solved! Go to Solution.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-31-2018 12:03 AM
Hi
Please find the below thread :-
Mark correct if i have helped.
Regards,
Omkar Mone.
www.dxsherpa.com

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-31-2018 12:03 AM
Hi
Please find the below thread :-
Mark correct if i have helped.
Regards,
Omkar Mone.
www.dxsherpa.com
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-31-2018 12:34 AM
Hi Omkar,
thanks for the link...I'm trying to take a solution form it...sounds like I need to add the callback to my alert() script...but the script in that thread won't work in an alert(). Any idea what I need to do to this? thanks again!
alert(getMessage('DP - survey target employees in germany - yes'), function(msg));//not working

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-31-2018 12:42 AM
HI,
Here you go :
https://community.servicenow.com/community?id=community_question&sys_id=19025feddbdcdbc01dcaf3231f9619a9
Thanks,
Ashutosh Munot
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-31-2018 12:48 AM
I figured it out...thanks guys!
if(count>=0 && count<2) {
getMessage('DP - survey target employees in germany - no', function(msg){
alert(msg);
});return false;
}