- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-03-2022 12:25 PM
Hello,
I have a Catalog item date field with (attached) Catalog UI Policy and/or Catalog Client Script is working fine in Service Catalog but not in Employee Portal?
In the Date Field, user will not be able to select any day that is less than 10 days from the current date;
Catalog Client Script:
function onChange(control, oldValue, newValue, isLoading) {
if (isLoading || newValue == '') {
return;
}
var ga = new GlideAjax('ValidateBusinessDays');
ga.addParam('sysparm_name', 'bdaysAgoStart');
ga.addParam('sysparm_day', "10");
ga.addParam('sysparm_newDate', newValue);
ga.getXML(validateDate);
}
function validateDate(response) {
var answer = response.responseXML.documentElement.getAttribute("answer");
if(answer=="error")
{
alert("Please select a date that is at least 10 business days from today");
g_form.setValue("what_is_the_requested_date_of_completion","");
}
}
Catalog UI Policy:
________________
Again, this works perfectly well in Service Catalog (ITIL) view - I'm not able to submit the form without adhering to the 10-day requirement.
BUT
Even though the message appears in Employee Portal, a User is still able to submit the form without meeting the 10-day requirement.
Is there a line of code or setup I am missing?
Thank you.
Solved! Go to Solution.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-03-2022 12:29 PM
Make type as All. Also, I hope your variable is mandatory. if so, just add below line after error message line:
g_form.setValue("preferred_due_date_of_the_request", " ");
Muhammad

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-03-2022 12:29 PM
Make type as All. Also, I hope your variable is mandatory. if so, just add below line after error message line:
g_form.setValue("preferred_due_date_of_the_request", " ");
Muhammad
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-03-2022 12:29 PM
Hello
in the Run script of the UI policy please change the "run scripts in UI type" field to "ALL" which runs in service portal and the catalog item view too