Skip to main content

Notifications

Finance | Project Operations, Human Resources, ...
Answered

Adding additional records to report data provider via extension

(0) ShareShare
ReportReport
Posted on by 50

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?

  • ChosenSilver Profile Picture
    ChosenSilver 50 on at
    RE: Adding additional records to report data provider via extension

    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.

  • Suggested answer
    Mohit Rampal Profile Picture
    Mohit Rampal 12,554 Super User 2024 Season 1 on at
    RE: Adding additional records to report data provider via extension

    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.  

  • GirishS Profile Picture
    GirishS 27,821 Super User 2024 Season 1 on at
    RE: Adding additional records to report data provider via extension

    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.

  • ChosenSilver Profile Picture
    ChosenSilver 50 on at
    RE: Adding additional records to report data provider via extension

    Looks like there is an internal class for a flight that is going to prevent me from being able to do this easily

    internal_5F00_class_5F00_error.png

  • ChosenSilver Profile Picture
    ChosenSilver 50 on at
    RE: Adding additional records to report data provider via extension

    Thanks for the suggestions to both of you. I am going to try that solution and report back if I was successful.

  • Suggested answer
    Mohit Rampal Profile Picture
    Mohit Rampal 12,554 Super User 2024 Season 1 on at
    RE: Adding additional records to report data provider via extension

    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.

  • Suggested answer
    GirishS Profile Picture
    GirishS 27,821 Super User 2024 Season 1 on at
    RE: Adding additional records to report data provider via extension

    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.

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Announcing Our 2025 Season 1 Super Users!

A new season of Super Users has arrived, and we are so grateful for the daily…

Announcing Forum Attachment Improvements!

We're excited to announce that attachments for replies in forums and improved…

Vahid Ghafarpour – Community Spotlight

We are excited to recognize Vahid Ghafarpour as our February 2025 Community…

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 291,969 Super User 2025 Season 1

#2
Martin Dráb Profile Picture

Martin Dráb 230,842 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Product updates

Dynamics 365 release plans