How to set a current date time in HR task due date
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-02-2023 10:06 PM
Hi,
I wanted to set a current date time in HR task due date, I have created a before insert BR-
(function executeRule (current, previous) {
var gr = new GlideRecord("sn_hr_core_case");
gr.addQuery("sys_id", current.parent);
gr.query();
if (gr.next()) {
if(current.short_description=='Request Active Directory ID (ADID)'){
var now = new GlideDateTime();
current.due_date = now;
}}
It is giving a empty Due date once task is created.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-02-2023 11:14 PM - edited ‎04-02-2023 11:15 PM
Hello @ST9,
You can set date/time as stated below.
current.due_date = gs.nowDateTime();
Regards,
Bharat Daswani
If provided answer helps you to address your issue, Would request you to Accept the Solution and hit "Helpful". Thank you!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-02-2023 11:18 PM
Hi,
No need to use the GlideRecord in before insert Business rule on HR task table. Try this updated scripts.
if(current.short_description == 'Request Active Directory ID (ADID)'){
var now = new GlideDateTime();
current.due_date = now;
}
Thanks,
Sagar Pagar