I am trying to write a script which validates the Outage start date and Outage end date be within Pl

Jagan9
Tera Contributor

I am trying to write a script include which validates the Outage start date and Outage end date be within Planned Start date and Planned end dates. Please some one help me out with this as its a little bit confusing to me.

7 REPLIES 7

Jagan9
Tera Contributor

this code is not working as expected.

 

DYCM
Mega Sage

Hi @Jagan9 ,

Please elaborate your requirement / issue, it would be helpful if you provide your expected result, the values of input parameters and the current output / result.

Bert_c1
Kilo Patron

Hi,

 

Try adding the following to debug:

 

gs.info("getOutageDetails: d1 = " + d1 + ", d2 = " + d2 + ", d3 = " + d3 + ", d4 = " + d4);

add before the "if" statement.

gs.info("getOutageDetails: returning: " + result);

add before "return" statement. I created records to test in 'task_outage' and 'cmdb_ci_outage', along with an onSubmit client script for 'change_request' table to call your script include, and got success when using outage dates within the Planned 'start_date' and 'end_date' fields on the change request. Seems you need to be clear on your requires as stated by Donald. Log entries:

*** Script	2023-09-16 08:06:40	Information	getOutageDetails: Found 1 outage records.
*** Script	2023-09-16 08:06:40	Information	getOutageDetails: returning: true
*** Script	2023-09-16 08:06:40	Information	getOutageDetails: d1 = 2023-09-18 00:00:00, d2 = 2023-09-15 07:32:00, d3 = 2023-09-22 23:59:59, d4 = 2023-09-23 07:40:00