- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-31-2023 07:33 PM
Hi,
Issue: When creating change Tasks on the change form, the values in the List View Fields (Panned Start Date and Planned End Date) are not populated, but when the change Task is opened, the values are populated. Please find the below screenshot for our reference.
Note: The values in the Change_task table are not reflected; how to use current.update(); method in Display BR for the following code Please help me with this.
Using Display Business Rule and onLoad Client scrip.
//Display Business Rule Code
(function executeRule(current, previous /*null when async*/) {
g_scratchpad.startdate= current.change_request.start_date.getDisplayValue();
g_scratchpad.enddate = current.change_request.end_date.getDisplayValue();
})(current, previous);
//OnLoad Client script code:
function onLoad() {
// if(g_form.isNewRecord()){
if (g_form.getValue('planned_start_date') == "") {
// alert("Planned start is emty :" +g_scratchpad.startdate);
g_form.setValue('planned_start_date', g_scratchpad.startdate);
}
if (g_form.getValue('planned_end_date') == "") {
// alert("Planned end is emty :" +g_scratchpad.enddate);
g_form.setValue('planned_end_date', g_scratchpad.enddate);
}
// }
}
How to solve this problem.
Solved! Go to Solution.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-01-2023 12:20 PM
Your existing implementation using display business rule and client script will only work when the change task form is opened.
If you wish to populate the planned_start_date and planned_end date at the time of creation of the change task (assuming they are created using some workflow) then create a before insert business rule on the change_task as follows.
Here is the script for the business rule.
(function executeRule(current, previous /*null when async*/) {
// Add your code here
current.planned_start_date = current.change_request.start_date+'';
current.planned_end_date = current.change_request.end_date+'';
})(current, previous);
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-11-2023 01:26 AM
Finally it's working with correct Time and Date.
(function executeRule(current, previous /*null when async*/ ) {
var chgstartdate = new GlideDateTime(current.change_request.start_date);
var chgenddate = new GlideDateTime(current.change_request.end_date);
current.planned_start_date =chgstartdate;
current.planned_end_date =chgenddate;
current.short_description = current.change_request.short_description+'';
})(current, previous);

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-01-2023 12:20 PM
Your existing implementation using display business rule and client script will only work when the change task form is opened.
If you wish to populate the planned_start_date and planned_end date at the time of creation of the change task (assuming they are created using some workflow) then create a before insert business rule on the change_task as follows.
Here is the script for the business rule.
(function executeRule(current, previous /*null when async*/) {
// Add your code here
current.planned_start_date = current.change_request.start_date+'';
current.planned_end_date = current.change_request.end_date+'';
})(current, previous);
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-01-2023 08:09 PM
Thank you Sandeep...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-07-2023 07:38 AM
Hi Sandeep,
The 'planned_start_date' and 'planned_end_date' dates were entered at the time the change task was created, but the timing is incorrect. (one hour back). Please see the screenshot below. Please help me with this.
Thanks
Suresh.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-07-2023 08:20 AM
@Suresh36 Can you please share the screenshot of When to run section of your business rule.