I want to calculate the age. It should be greater than 18 years.

Tanishka Arora1
Kilo Contributor

I have a variable on catalog item named "date of birth". I want to calculate the age. If the age is less than 18 years then it should alert a message. 

 If I am born on/before 15th Oct 2002, I shouldn’t see this message as today's age is 15th Oct 2020.

5 REPLIES 5

asifnoor
Kilo Patron

Hello Tanishka,

You can also create a UI policy on your table and select following conditions

Dob relative before 18 years ago

Select run scripts

if false, put an error message g_form.showFieldMsg

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

Mark the comment as a correct answer and helpful if it helps to solve the probem.