I am trying to write a script include which validates the Outage start date and Outag end with

Jagan9
Tera Contributor

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

 

Screenshot_20230917-115426_WhatsApp.jpg

.

3 REPLIES 3

Jagan9
Tera Contributor

Can you please help on this

AnveshKumar M
Tera Sage
Tera Sage

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 👍

Thanks,
Anvesh

Saurabh Gupta
Kilo Patron
Kilo Patron

Hi,
This can be achieved using ui policy.
Sample-

SaurabhGupta_0-1694946958530.png

 

 


Thanks and Regards,

Saurabh Gupta