- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-27-2023 07:44 AM - edited 06-27-2023 07:48 AM
Hello Everyone,
1) I need to Auto populate the 'Due Date' field value depending on employee's start date.
2) Due Date field I created it in 'HR Task' table and 'employee start date' field value is available in 'HR Profile' table.
3) So I created a Before-Insert, Update business rule in the 'HR Task Table' to get the value of 'employee start date' and to populate 'Due Date' value.
But whatever I created that is not working as expected, I am attaching the screenshots for reference. Please help me out with your suggestions/solutions.
Many Thanks in Advance!!
Kind Regards,
Bhuvana
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-27-2023 11:01 AM
Remove the current.update() line. I forgot you mentioned this is a BEFORE business rule.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-27-2023 08:56 AM
Try this.
var date;
var par = current.parent.subject_person;
var gr = new GlideRecord('sn_hr_core_profile');
gr.addQuery('user', par);
gr.query();
while(gr.next()){
date = new GlideDateTime(gr.getValue('employment_start_date'); //If this is a DATE ONLY field, change to date = new GlideDateTime(gr.getValue('employment_start_date') + " 00:00:00");
date.addDays(7);
}
current.u_due_date = date; //If you need DATE ONLY, change to current.u_due_date = date.getDate();
current.update();
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-27-2023 09:08 AM
Hello Claude,
I am getting these errors, can you please clarify this?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-27-2023 11:01 AM
Remove the current.update() line. I forgot you mentioned this is a BEFORE business rule.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-27-2023 11:13 AM
Thank you Claude, working as expected.