Following is the code which will help users to copy and paste the planned Work into actual work in their timesheet.
- Create a Notepad file and put the below code in
<html>
<div id ="target" style="color:Blue;background-color:#f2f2f2;" align="right">Click here to copy Planned into Actuals!!</div>
<script src="https://code.jquery.com/jquery-1.9.1.min.js"></script>
<script>
$( "#target" ).click(function() {
var mytable;
$("table").each(function(){
var curTable = $(this);
mytable=$(this).attr("id");
try
{
if(mytable.indexOf('_TimesheetPartJSGridControl_rightpane_mainTable') > -1)
{
//ctl00_ctl00_ctl40_g_cef6eb03_a126_4f2c_b4e5_197335c9f5f1_TimesheetPartJSGridControl_rightpane_mainTable
var table = document.getElementById(mytable);
for (var i=1, row; row = table.rows[i]; i++)
{
var rownumber=0;
//iterate through rows
//rows would be accessed using the "row" variable assigned in the for loop
for (var j = 1, col; col = row.cells[j]; j++)
{
//iterate through columns
//columns would be accessed using the "col" variable assigned in the for loop
try
{
var a=row.cells[0].firstChild.innerHTML;
if(a=="Planned")
{
rownumber=i-1;
var AVal=table.rows[i].cells[j].innerHTML;
if(AVal.toString()!="")
{
table.rows[rownumber].cells[j].innerHTML="<span>"+AVal.toString()+"</span>";
}
}
}
catch(err){ alert(err.message);}
}
}
alert("Operation Completed!!");
}
}
catch(err1){}
});
});
</script>
</html>
- 3 Now, Upload the same text file into the Site Assets folders
- 4 then add CEWP to the Timesheet page and link them to above code by editing the webpart
- 5 Once, linked with the text file. A button (“Click here to copy Planned into Actuals!!”) appear which will just copy and paste planned work to actual work.
Result will look something like this

Above code to work do not forget to add the Planned Row into your timesheet view. Same can be enabled by going to the options tab on timesheet page and then checking the Planned checkbox.
Hope this helps someone!







