- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-07-2018 09:30 AM
We have a custom date field where we do not want anyone to specify a date at the end of the month - day 29, 30, and 31.
I tried a business rule and an "on change" client script, but i guess my coding wasn't good enough. Can anyone help?
Thanks!
Tyler
Solved! Go to Solution.
- Labels:
-
Incident Management
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-08-2018 08:12 AM
Try this:
(function calculatedFieldValue(current) {
var date = new GlideDateTime(current.u_bill_cycle_date);
return date.getDayOfMonthLocalTime(); // return the calculated value
})(current);
Please mark my response as correct and helpful if it helped solved your question.
-Thanks

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-07-2018 09:42 AM
If it is in a Catalog Item, using a Catalog UI Policy typically works pretty well, with little impact on the instance. I haven't really investigated using something like this outside of a catalog item, but it should be similar. I also have it running On Load, only on Catalog Item View, and not Reverse if False.
Issue: I don't want anyone to select a date before 4 weeks from now.
Catalog Condition:
- myvariable relative before 28 days from now
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-07-2018 10:03 AM
Hey Scott,
Thanks for the reply, but we are looking to validate the day of the date chosen. The day itself cannot be the 29th, 30th, or 31st.
I found this code .getDayOfMonth() but have not been able to successfully apply it
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-08-2018 06:40 AM
We had an idea to create a custom field called "Day of Month". This field will be calculated from the other custom date field. Then we can set-up business rules and/or reports based on that field's value. Only problem is that we are having trouble auto calculating the "Day of the Month" field. Below is a version of the script I have been trying to use. Can anyone help me accomplish this?
(function calculatedFieldValue(current) {
var billDate = u_bill_cycle_date;
// Add your code here
return billDate.getDayOfMonthLocalTime(); // return the calculated value
})(current);
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-08-2018 08:12 AM
Try this:
(function calculatedFieldValue(current) {
var date = new GlideDateTime(current.u_bill_cycle_date);
return date.getDayOfMonthLocalTime(); // return the calculated value
})(current);
Please mark my response as correct and helpful if it helped solved your question.
-Thanks