How to set a condition for start date and end date saying start date should not exceed end date.

poornima batchu
Tera Expert

Hi everyone.

I created two date type fields( start date and end date ) now I have to add a condition saying end date should always be greater than the start date. Also whenever user select end date which is not greater than start date it should pop up a message saying please select correct end date something like that. please provide solutions for this.  

 

thank you in advance.

1 ACCEPTED SOLUTION

chrisperry
Giga Sage

Hi there,

You can use a UI policy to accomplish your requirements. The When to Apply conditions should be Start Date is more than Days after End Date, and then you can use the Run Scripts section and Execute if true code block to display your pop-up / other desired logic if the Start Date is indeed greater than the End Date.

UI Policy:

find_real_file.png

find_real_file.png

Result:

find_real_file.png

If this answer is helpful please mark correct and helpful!

Regards,

Christopher Perry

If this answer is helpful please mark correct and helpful!

Regards,
Chris Perry

View solution in original post

2 REPLIES 2

chrisperry
Giga Sage

Hi there,

You can use a UI policy to accomplish your requirements. The When to Apply conditions should be Start Date is more than Days after End Date, and then you can use the Run Scripts section and Execute if true code block to display your pop-up / other desired logic if the Start Date is indeed greater than the End Date.

UI Policy:

find_real_file.png

find_real_file.png

Result:

find_real_file.png

If this answer is helpful please mark correct and helpful!

Regards,

Christopher Perry

If this answer is helpful please mark correct and helpful!

Regards,
Chris Perry

Palak Gupta
Tera Guru
Tera Guru

Hi @poornima batchu

Please refer below article

https://community.servicenow.com/community?id=community_article&sys_id=f61964aadbcb3fc85129a851ca961...

Please mark my answer correct and helpful if this resolves your issue.
Regards,
Palak