Date should not be day before today
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-21-2022 01:35 AM
I have one field called "Extended Date" that date should not be day before today.
So the issue is when i am using any client script and script include for this it reflect in both Native UI and Agent Workspace in My PDI but When I Implement this code in my client instance its is not working.beacuse that case table i am created in customer service scope.
client script:
field_name:u_extended_date
function onChange(control, oldValue, newValue, isLoading)
{
if(isLoading){ return; }
if(newValue != ''){
var ga = new GlideAjax('CheckDate');
ga.addParam('sysparm_name', 'chkCatDate');
ga.addParam('sysparm_date',g_form.getValue('u_extended_date'));
ga.getXML(DatParse);
}
function DatParse(response){
var answer = response.responseXML.documentElement.getAttribute("answer");
if(answer == 'false'){
g_form.addErrorMessage("Date cannot exist in past.");
g_form.setValue('u_extended_date', ''); // Empty the variable.
}}}
Script Include:
var CheckDate = Class.create();
CheckDate.prototype = Object.extendsObject(global.AbstractAjaxProcessor, {
chkCatDate : function(){
var start = this.getParameter('sysparm_date');
var currDay = gs.now();
if(start < currDay){
return false;
}
else
{ return true; } } });
- Labels:
-
Agent Workspace

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-21-2022 08:48 PM
HI,
You can do a ui policy as below, simple no code solution
In the script part you can add an alert or something to show the error and clear the field value.
- Vaishnavi
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-22-2022 04:56 AM
Even i did this same Ui policies to resolve but it reflect in Native Ui not in Agent workspace.