- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-26-2023 12:58 AM
In existing user table i added date of birth for users and now i have to create dashboard for upcoming birthday list and every year it need to show how can i acheive this?
Solved! Go to Solution.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-26-2023 01:59 AM
Sure thing!
Write a business rule, as below:
And as script, write something like this:
(function executeRule(current, previous /*null when async*/) {
var nextBirthday = new GlideDateTime(current.getValue('u_birth_date')); // change field name to your custom field name
while(nextBirthday.before(new GlideDateTime())){
nextBirthday.addYears(1);
}
current.setValue('u_next_birthday', nextBirthday); // change field name to your custom field name
})(current, previous);

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-26-2023 11:32 AM - edited ‎07-26-2023 11:36 AM
I prefer Flow designer over scheduled job, but you can go with either one.
No condition should be needed on the trigger, other than it should run yearly on the first day of the new year.
Adding a simple example below, using Flow designer.
Providing some explanation of some of the steps in the Flow below, first step 1
Step 3
Step 5
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-27-2023 02:22 AM
thanks olaN,
but i used this method directly called script include function name in reports field for upcoming bdays anniversary in dashboard and its working fine
function upAnniversary() {
var upanniversary = [];
var today = new GlideDate();
var format = today.getByFormat('MM');
var userGR = new GlideRecord('sys_user');
userGR.addActiveQuery();
userGR.addQuery('u_dobISNOTEMPTY');
userGR.query();
while (userGR.next()) {
var DOJ = userGR.u_doj.toString();
var anniversary = DOJ.split("-");
DOJ = anniversary[1] + '-' + anniversary[2];
if (format == anniversary[1]) {
upanniversary.push(userGR.getValue('name'));
//gs.print(userGR.name);
}
}
return upanniversary;
}

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-26-2023 02:04 AM
Don't forget, you will also need to create a Flow or scheduled job, that runs yearly, and updates the next birthday date on all existing records.