Hello People,
Recently I was involved in an upgrade project for AX2012R2 from CU6 to CU7. An interesting issue has been detected by our team and fixed by me. The issue consists in the fact that all the users are not able to see all their previous comments inserted in timesheets. Sometimes the internal and external comments provided by users are very significant for team leaders/project managers and administration. The further investigations proved that the internal/external comments still are stored in the TSTimesheetTrans table. The new design of the comments area for timesheets in CU7 involve the TSTimesheetLineWeek table. So, the goal is to refresh/update the TSTimesheetLineWeek table records. See below a job that performs this task.
Hopefully it will be useful.
Recently I was involved in an upgrade project for AX2012R2 from CU6 to CU7. An interesting issue has been detected by our team and fixed by me. The issue consists in the fact that all the users are not able to see all their previous comments inserted in timesheets. Sometimes the internal and external comments provided by users are very significant for team leaders/project managers and administration. The further investigations proved that the internal/external comments still are stored in the TSTimesheetTrans table. The new design of the comments area for timesheets in CU7 involve the TSTimesheetLineWeek table. So, the goal is to refresh/update the TSTimesheetLineWeek table records. See below a job that performs this task.
Hopefully it will be useful.
static void vp_updateLineWeekCommentsFromTrans(Args _args)
{
TSTimesheetTrans timesheetTrans;
FromDate fromDate;
ToDate toDate;
TSTimesheetLineWeek lineWeek;
ProjTransDate currDate;
int dayOffset;
Counter i = 1;
ttsBegin;
while select forUpdate lineWeek
//TODO Enable these ranges if you want to run the job for a specific period
/*where lineWeek.DayFrom >= str2DateDMY("16/06/2014")
&& lineWeek.Dayto <= str2DateDMY("22/06/2014")
*/
{
currDate = lineWeek.DayFrom;
dayOffset = TSPeriods::getDayOffset(ProjPeriodTable::find(lineWeek.ProjPeriodId).WeekStart, currDate);
if (lineWeek.DayTo - lineWeek.DayFrom == 6)
{
dayOffset = 1;
}
while (currDate <= lineWeek.DayTo)
{
select timesheetTrans
where timesheetTrans.tsTimesheetLineWeek == lineWeek.RecId &&
timesheetTrans.ProjTransDate == currDate;
if (timesheetTrans)
{
lineWeek.InternalComments[dayOffset] = timesheetTrans.IntComment;
lineWeek.ExternalComments[dayOffset] = timesheetTrans.ExtComment;
lineWeek.update();
}
else if (lineWeek.Hours[dayOffset])
{
warning(strFmt("For the record %1, day %2 from TSTimesheetLineWeek was not identified the related TSTimesheetTrans record.", lineWeek.RecId, currDate));
}
currDate++;
dayOffset++;
}
}
ttsCommit;
}
No comments:
Post a Comment