I am working on an issue with the WHSLoadList report, where Open shipments are not showing on the report in the case where work was cancelled. These shipments still end up getting added to loads, but do not show on the report.
I can see in the report data provider why these records are not included (because of the cancelled work status)
while select workLine join workTable group by workLine.WorkId where workLine.ShipmentId == whsShipmentTable.ShipmentId && workTable.WorkId == workLine.WorkId && workTable.WorkStatus != WHSWorkStatus::Combined && workTable.WorkStatus != WHSWorkStatus::Cancelled { if (!prevWorkId || prevWorkId != workLine.WorkId) { shipFreightPieces ; prevWorkId = workLine.WorkId; } }
My initial though was to create a COC on the processReport() method and then insert the missing shipments to the WHSLoadListTmp table, but when I do this the values do not show. Going through debug I can see that my code is being hit but where it temp tables I am starting to wonder if the data is being inserted into a different instance of the table. For reference, here is my COC (using dummy data just to show it was possible)
public void processReport() { next processReport(); WHSLoadListTmp whsLoadListTmp; whsLoadListTmp.LoadId = '100198651'; whsLoadListTmp.ShipmentId = '66'; whsLoadListTmp.ShipmentStop = 5; whsLoadListTmp.insert(); }
Is it even possible to do what I am trying to do, or do I need to make a whole new version of the report with it's own data provider and basically copy the base data provider and change the criteria that are causing my shipments to be missing?
Our report design was already duplicated for this one, but it was using the original RDP with a COC extension to add some additional data. I ended up deciding to duplicate the RDP class as well and bring our COC code into this duplicated class, with the correction to the queries that were excluding the cancelled work.
I think this internal method should not be issue. Since you don't have to change report design you can extend processReport method using Coc, let standard processReport run first to import all records as per conditions like avoid Cancelled work.
Duplicate processReport, workIdsForShipmentId and shipmentLocationList methods and after Next statement in processReportNew extension method, call shipmentLocationListNew method instead of shipmentLocationList.
In shipmentLocationListNew method, replace workIds initialization with below statement
List workIds = this.workIdsForShipmentIdNew(whsShipmentTable.ShipmentId);
And in workIdsForShipmentIdNew, replace while select loop conditions with only condition where WorkStatus == Cancelled
This will ensure that standard records are inserting and you are adding new records on top of it.
You can duplicate the class but that's not recommended approach.
You need to fix this either using COC or event handler for processReport method.
Refer to the below blog which might help you.
https://nuxulu.com/2019-10-10-extend-the-standard-reports-in-dynamics-365-finance-and-operations/
Thanks,
Girish S.
Looks like there is an internal class for a flight that is going to prevent me from being able to do this easily
Thanks for the suggestions to both of you. I am going to try that solution and report back if I was successful.
Hi, As you mentioned system's condition is to avoid cancelled work and I can see you can't extend 'workIdsForShipmentId' method as it is private method. So, As Girish mentioned best to create a duplicate report and remove cancelled condition from that method.
Hi,
In the COC you need to again add the query to get the canacelled status of work load - use the query run to insert into temp table.
This will make the report to consume more time because of two queries - one will be standard query and other will be you custom query added in COC.
This will make the report to consume more time to show the output.
So my suggestion will be considering the performance, you can go with duplicating the report and add your logic for cancelled work load status.
Thanks,
Girish S.
André Arnaud de Cal...
291,969
Super User 2025 Season 1
Martin Dráb
230,842
Most Valuable Professional
nmaenpaa
101,156