date validation

SAI VENKATESH
Tera Sage
Tera Sage

Hi 

 

I have written the code in wait for conditon in servicenow but I am getting the error as "class java.lang.Boolean cannot be cast to class java.lang.String (java.lang.Boolean and java.lang.String are in module java.base of loader 'bootstrap')"

// Retrieve departure date from the catalog item
var currentdate = String(new GlideDateTime().getDate());
var releasedate=fd_data._1__get_catalog_variables.start_date;
gs.info("the start date is"+releasedate);
gs.info("the type is "+typeof(releasedate));//string

return currentdate==releasedate

  

2 REPLIES 2

Amit Verma
Kilo Patron
Kilo Patron

Hi @SAI VENKATESH 

 

Could you please let me know the type of catalog variable "start_date" ? Also, can you please share the complete script which you are using in the wait for condition.

 

Thanks and Regards

Amit Verma


Please mark this response as correct and helpful if it assisted you with your question.

Kavita_Bhojane
Tera Guru

Hi @SAI VENKATESH ,

 

Why are you converting current date to string? Please share complete code which you are using in the wait for condition or share the requirements you want to achieve.

 

Please mark my answer helpful and accept as a solution if it helped 👍✔️

Thanks,
Kavita Bhojane