How to create a report for HR cases created later than 10 days of Employment start Date.

Harshitha SR1
Tera Contributor

Hi All,

 

Need to know how to create a report for HR cases created later than 10 days of Employment start Date.

 

As you can see the sys_created_on (Created) field  is GlideDate format where it will show date and time and the Employment Start Date is Date field.

 

So please can anyone suggest how to create a report for HR cases later than 10 days of the Employment Start Date.

 

Thanks,

Har**bleep**ha 

3 REPLIES 3

AndersBGS
Tera Patron
Tera Patron

Hi @Harshitha SR1 ,

 

According to my knowledge, you need a script to calculate the date difference between the profile.employment_start_date and the created date and a field (can be hidden) to store tha output of the calculation. There is no OOTB solution which can calculation the difference. 

 

If my answer has helped with your question, please mark my answer as accepted solution and give a thumb up.

 

best regards

Anders

If my answer has helped with your question, please mark my answer as the accepted solution and give a thumbs up.

Best regards
Anders

Rising star 2024
MVP 2025
linkedIn: https://www.linkedin.com/in/andersskovbjerg/

Hi @AndersBGS 

 

Thanks, Can you provide me the steps or the script to achieve it.

 

Thanks,

Har**bleep**ha SR

Shruti Khaire
Kilo Sage

Hello @Harshitha SR1,

 

I have used this code in my requirement to calculate the date difference. I will attach snippet below for the same hope it helps.

 

var date1 = new GlideDateTime("2011-08-28 09:00:00");

var date2 = new GlideDateTime("2011-08-31 08:00:00");

var diff = GlideDateTime.subtract(date1, date2);

gs.info(diff.getDisplayValue());

 

If you need to refer it on any fields from a record then specify dates as:

var grTable = new GlideRecord("custom_table");//using gr as the gliderecord variable name is not a good practice and there can't be a space in the table name
grTable.addEncodedQuery('active=true');
grTable.query();

while (grTable.next()) {
var startDate = new GlideDateTime(grTable.getDisplayValue('field1'));
var endDate = new GlideDateTime(grTable.getDisplayValue('field2'));
var duration = GlideDateTime.subtract(startDate, endDate);

 

Thank you!