- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-21-2024 06:20 AM - edited 05-21-2024 06:27 AM
I have a file form and in that form there is a termination date field on the form. So whenever state is moving from transmission to terminate some tasks are getting created based on conditions and in those tasks i have a due date field so whenever the tasks are getting created we should assign the termination date field to due date field for all tasks .I have created a BR for it , Its assigning the termination date but termination date is a date field and due date is date and time field so when populating if i give termination date as 31-06-2024 its taking the value as 30-06-2024 7:00:00. Any way if we can put the same date?
The script is
var gr = new GlideRecord("file_task");
gr.addQuery("file_rout", current.sys_id);
gr.query();
while(gr.next()){
gr.due_date = current.termination_date;
gr.update();
}
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-21-2024 09:59 AM
Hi @gayatri38
Understood please try the below script:
var gr = new GlideRecord("file_task");
gr.addQuery("file_rout", current.sys_id);
gr.query();
while (gr.next()) {
var terminationDate = new GlideDateTime(current.termination_date);
var dueDateTime = new GlideDateTime(terminationDate);
dueDateTime.addSeconds(86399);
gr.due_date = dueDateTime;
gr.update();
}
If you find my response helpful, please consider marking it as the 'Accepted Solution' and giving it a 'Helpful' rating. Your feedback not only supports the community but also encourages me to continue providing valuable assistance.
Thanks,
Amitoj Wadhera
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-21-2024 08:19 AM
Hi @gayatri38 ,
Below is the adjusted Business Rule script:
var gr = new GlideRecord("file_task");
gr.addQuery("file_rout", current.sys_id);
gr.query();
while (gr.next()) {
var terminationDate = new GlideDate(current.termination_date);
var dueDateTime = new GlideDateTime(terminationDate);
dueDateTime.setDisplayValue(dueDateTime.getDisplayValue() + " 23:59:59");
gr.due_date = dueDateTime;
gr.update();
}
If you find my response helpful, please consider marking it as the 'Accepted Solution' and giving it a 'Helpful' rating. Your feedback not only supports the community but also encourages me to continue providing valuable assistance.
Thanks,
Amitoj Wadhera
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-21-2024 09:16 AM
Hi @Amitoj Wadhera - Currently this script is in a scoped application and GlideDate is throwing an error .
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-21-2024 09:59 AM
Hi @gayatri38
Understood please try the below script:
var gr = new GlideRecord("file_task");
gr.addQuery("file_rout", current.sys_id);
gr.query();
while (gr.next()) {
var terminationDate = new GlideDateTime(current.termination_date);
var dueDateTime = new GlideDateTime(terminationDate);
dueDateTime.addSeconds(86399);
gr.due_date = dueDateTime;
gr.update();
}
If you find my response helpful, please consider marking it as the 'Accepted Solution' and giving it a 'Helpful' rating. Your feedback not only supports the community but also encourages me to continue providing valuable assistance.
Thanks,
Amitoj Wadhera
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-21-2024 10:26 AM
thanks , it worked.