Hi,
Someone has already created timesheet line by code. The record is created but I don't see the result in my form. Maybe I forgot something in my code :
TSTimesheetTable tsTimesheetTable = TSTimesheetTable::find("XXXXXXXXX");
TSTimesheetLine tTimesheetLine;
tTimesheetLine.ProjId = "YYYYYYYYY";
tTimesheetLine.TimesheetNbr = tsTimesheetTable.TimesheetNbr;
tTimesheetLine.ProjPeriodTimesheetWeek = tsTimesheetTable.RecId;
tTimesheetLine.ProjectDataAreaId = curext();
tTimesheetLine.initValue();
if (tTimesheetLine.validateWrite())
{
tTimesheetLine.insert();
TSTimesheetLineWeek::loadFromLine(tTimesheetLine, NoYes::No);
}
Thanks in advance
*This post is locked for comments
Dona83,
I just dealt with the same problem, and as our company has been creating a time tracking app for AX in C# and using AIF Services. A few things that helped us track down how to implement were:
1) Compare data in these tables between what the AX client generates and what you are doing:
select * from TSTIMESHEETTABLE select * from TSTIMESHEETLINE select * from TSTIMESHEETLINEWEEK select * from TSTIMESHEETTRANS
2) Review the code under \Classes\TSTimesheetService in AOT. I wound up rewriting some of the code in there but it's a great place to see what's going on under the hood. Check out these methods: createNewTimesheet, createOrUpdateTimeEntry, createOrUpdateTimesheetLines
3) It could be something we misconfigured, but if you require start-stop times, you might find the transactions are not getting created by the methods in (2), so you might need to roll your own method for that.
Reply if you want to look at some code. :-)
-Brian
Hi,
I had checked the form datasources. The TsTimesheetTrans is filled when you encoded hours... I have tried many. The data genered by code seems the same (in tables line and lineweek) but I spend side of something.
Have you already created lines for thimesheet by code?
Best regards
Hi,
Check the form datasources used. There are usually also records created in the table TsTimesheetTrans. Is there one or more corresponding records in this table created with above code?
Stay up to date on forum activity by subscribing. You can also customize your in-app and email Notification settings across all subscriptions.
André Arnaud de Cal... 291,113 Super User 2024 Season 2
Martin Dráb 229,918 Most Valuable Professional
nmaenpaa 101,156