- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-14-2016 10:36 AM
Is there a way to put a warning message on a record producer (Either when first going to the form or after submitting) that only shows up after a certain time?
I need to put a warning up that shows up only during the hours of 5 PM - 8 AM.
Thank You!
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-15-2016 01:29 PM
oops, i think i screwed you up earlier.
looking at the error it says that it doesn't recognize the function isInSchedule('string') - becasue that function requires a date object not a string. i told you getNow would be an object and that's where i messed you up.
put this back in
var schedTime = new GlideDateTime(gs.nowDateTime());
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-15-2016 11:36 AM
I wouldn't do this with a client script - client side treats dates different (as a string) then server side (as an object).
If you keep it in the record producer script, it should act as an on submit.
The gs.log will be in System Logs > All. The message will start with "Time 1:"
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-15-2016 12:23 PM
In the logs I found this:
org.mozilla.javascript.EcmaError: "CalculateTime" is not defined.
Caused by error in Business Rule: 'Calculate Time 2' at line 1
==> 1: CalculateTime();
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-15-2016 12:30 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-15-2016 12:09 PM
Yes, you are right.. I just tested this on a machine on the west coast and it doesn't prompt at the current time like it is on the east coast. I tried putting the same script in the record producer script... but it does nothing:
function onSubmit() {
var today = new Date().getHours(); //compare in 24h
if (today >= 8 && today <= 14) { //8AM-5PM
} else {
alert('After Hours');
}
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-15-2016 12:37 PM
can you post the full script? We are probably mixing client side functions that won't work on the server side (like alert())