I am trying to write a script include which validates the Outage start date and Outag end with
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-16-2023 11:26 PM
I am trying to write a script include which validates the Outage start date and Outage end date be within change Planned Start date and change planned end dates. The below background script is not working
.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-16-2023 11:27 PM
Can you please help on this
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-16-2023 11:58 PM
Hi @Jagan9
It is better to use system format of date time (yyyy-MM-dd HH:mm:ss) for better results.
In your case the dates you supplied matches with, MM-dd-yyyy HH:mm:ss instead of dd-MM-yyyy HH:mm:ss as it comes first in the order.
So the evaluation works differently. Try with the following code.
var CSRT = new GlideDateTime("2023-09-21 04:58:11");
var CEND = new GlideDateTime("2023-11-01 04:58:18");
var OSRT= new GlideDateTime("2023-10-02 04:58:18");
var OEND = new GlideDateTime("2023-10-02 09:58:18");
if(OEND <= CEND){
gs.info("Display the values");
}
Please mark my answer helpful and accept as solution if it helped you to fix the issue ✅👍
Anvesh
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-17-2023 03:36 AM
Hi,
This can be achieved using ui policy.
Sample-
Thanks and Regards,
Saurabh Gupta