The field values in the List View are not populated when creating a change task on change Form.

Suresh36
Tera Expert

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.

 

Suresh36_0-1680316111665.png

Suresh36_1-1680316173656.png

 

2 ACCEPTED SOLUTIONS

Sandeep Rajput
Tera Patron
Tera Patron

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.

 

Screenshot 2023-04-02 at 12.33.56 AM.pngScreenshot 2023-04-02 at 12.34.16 AM.png

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);

View solution in original post

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);

View solution in original post

13 REPLIES 13

Please find the screenshots of When to run

Suresh36_0-1680881220517.pngSuresh36_1-1680881267151.png

 

I believe it is daylight saving time. 

Please assist me on this

Please just share the screenshot of your business rule. Will provide further inputs afterwards.

Please find the screenshots of BR

Suresh36_0-1680888319772.png

 

Yes you are right, this looks like a day light saving time issue. Is it happening in every change request and associated task or it was just one of an instance where this mismatch occured.