- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-12-2020 05:20 AM
Hey Guys,
Im trying put an error or info message under the field. But it's not reflecting.
g_form.showFieldMsg("start_date","Selected Date is in past, Select a valid date","info",true);
suggest me something here
Solved! Go to Solution.
- Labels:
-
Change Management
-
Service Catalog

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-12-2020 05:58 AM
Hi,
Was that not happening before?
Actually, you know what...hmm...try clearing the field first THEN do your field message.
g_form.setValue('start_date', ''); // Setting the variable as empty
g_form.showFieldMsg('start_date', "Test 123", 'error');
Please mark reply as Helpful/Correct, if applicable. Thanks!
Please consider marking my reply as Helpful and/or Accept Solution, if applicable. Thanks!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-12-2020 05:28 AM
Hi,
There is no issue in the script or syntax.
How and where are you using this?
-Anurag
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-12-2020 05:33 AM
Hi Anurag,
I'm using on change_request table on start_date.
If user select's a past date from current.
Alert is working fine but i wish to show msg under the particular .
Suggest me some things.
Errorbox would also work.
Please provide syntax , if possible

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-12-2020 05:28 AM
That line looks correct so maybe it's how you have your client script setup? Can you share full script?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-12-2020 05:34 AM
Hi Fry,
Find the complete script below,
function onChange(control, oldValue, newValue, isLoading, isTemplate) {
if (isLoading || newValue === '') {
return;
}
//Type appropriate comment here, and begin script below
var change = g_form.getValue('u_change_type');
//if(newValue != '')
if(newValue == 'major'||'minor');
{
var ga = new GlideAjax('ConfirmDate');
ga.addParam('sysparm_name', 'chkCurrDate');
ga.addParam('sysparm_date',g_form.getValue('start_date'));
ga.getXML(NewParse);
}
function NewParse(response){
var answer = response.responseXML.documentElement.getAttribute("answer");
if(answer == 'false'){
g_form.showFieldMsg("start_date","Selected Date is in past, Select a valid date","error",true);
g_form.setValue('start_date', '');
g_form.setValue('end_date','');// Setting the variable as empty
}
}
}
suggest me