4

For our client timesheets come in to D365 in an approved status (bypassing the workflow). However, some timesheets are appearing in 'Reset unposted timesheets to draft' which is causing confusion.   


Each table has a RecId that is unique on its own table, meaning that no 2 records on the same table have the same RecId however, this RecId isn’t necessarily unique on 2 different tables. 

Also, the workflow tracking status table has a link to this RecId and the TableId.


So basically, what is happening here is that there are 2 tables with the same RecId (which again, no problem with this) and the query used only links on the RecId (doesn’t care about the TableId to link to the timesheet table)

Example: Timesheet has the RecId of 5637380088, but there is another record on IQ01 on the table (LedgerJournalTable) mentioned on the TableId that has a workflow associated with it.


 Basically, the query on this form is taking the RecId from the TSTimesheetTable and linking with the WorkflowTrackingStatusTable (It does other links and verifications to make sure if they should appear on the form, but they are irrelevant for this issue).

             The problem here is that, with only this RecId link, there is no way to verify if the WorkflowTrackingStatusTable record is supposed to be for Timesheets or for any other table. For Example:

  • We have 2 tables with the same RecId. TSTimesheetTable and LedgerJournalTable with RecId 5637380088 (This can happen, this is normal, no issues here).
  • The TSTimesheetTable doesn’t have a workflow associated, but the LedgerJournalTable does have one:
  • So, when the query is trying to link the TSTimesheetTable with the WorkflowTrackingStatusTable using only the RecId, it finds the workflow for the LedgerJournalTable. Which is completely wrong.


To fix this issue I suggest confirming if the workflow is from a timesheet using the ContextTableId available on the WorkflowTrackingStatusTable, or, using the Document field to check for Timesheets only.

 


STATUS DETAILS
New