Skip to main content

Notifications

Announcements

No record found.

Small and medium business | Business Central, N...
Answered

¿Standard BC date fields not showing on PO Report when the first line is a comment?

(1) ShareShare
ReportReport
Posted on by 130
This is a very strange bug relating to the standard Requested Receipt Date and Promised Receipt Date fields in the Purchase Order (Purchase Header Table 38, Purchase Order Page 50).
 
The date fields have already been added to the Purchase Order Word Report and are displayed fine—unless the first line in the Purchase Line table is of type Comment, in which case the field values are not displayed at all.
 
Any idea how it would be possible to fix this buggy behavior, perhaps hopefully with a few lines in a table or report extension? Would it be easier than creating 2 new date fields, adding them to the report, and flowing them over to the Purchase Invoice table/page/reports also...?
 
 
Thanks!
  • Verified answer
    CU05061853-0 Profile Picture
    CU05061853-0 130 on at
    ¿Standard BC date fields not showing on PO Report when the first line is a comment?
    Thanks so much, that worked!

    For anyone else trying to do this, don’t forget to also add the rendering section to generate the new report files, copy your previous layout, then change the fields in question to the newly added ones and assign them on the Report Selection Purchase page. 
     
    reportextension 50250 POReportExt extends "Standard Purchase - Order"
    {
        dataset
        {
            add("Purchase Header")
            {
                column(Promised_Receipt_Date; Format("Promised Receipt Date", 0, 4))
                {
                }
                column(Requested_Receipt_Date; Format("Requested Receipt Date", 0, 4))
                {
                }
                //above fixes BC bug of fields not showing on the PO Report when 1st Purchase Line is of type <> Item
            }
        }
        rendering
        {
            layout("CustomPurchaseOrder.docx")
            {
                Type = Word;
                LayoutFile = './Purchases/Document/CustomPurchaseOrder.docx';
                Caption = 'Custom Purchase Order (Word)';
                Summary = 'Custom Purchase Order report with fixed PO date fields.';
            }
            layout("GPFFFPurchaseOrderEmail.docx")
            {
                Type = Word;
                LayoutFile = './Purchases/Document/CustomPurchaseOrderEmail.docx';
                Caption = 'Custom Purchase Order Email (Word)';
                Summary = 'Custom Purchase Order report with fixed PO date fields.';
            }
        }
    }
  • Verified answer
    YUN ZHU Profile Picture
    YUN ZHU 74,115 Super User 2024 Season 2 on at
    ¿Standard BC date fields not showing on PO Report when the first line is a comment?
    Hi, It doesn’t need to be so complicated, and there is no need to copy the standard code. The following should solve the problem.
     
    Hope this helps.
    Thanks.
    ZHU
  • CU05061853-0 Profile Picture
    CU05061853-0 130 on at
    ¿Standard BC date fields not showing on PO Report when the first line is a comment?
    Or perhaps there is a quicker way to copy the value of the original Report fields into newly created fields/variables in the extension, and then add these to the Purch Header report dataset…?
     
    Found this system built-in Record.Copy method in the docs, but not sure where/how to declare it properly; the below code yields an error. Would appreciate some guidance on how to add this in, if it's feasible.
     
    tableextension 50250 PurchHeaderExt extends "Purchase Header"
    {
        fields
        {
            field(50250; CopyRequestedReceiptDate; Date)
            {
                Caption = 'Copy Requested Receipt Date';
            }
            field(50251; CopyPromisedReceiptDate; Date)
            {
                Caption = 'Copy Promised Receipt Date';
            }
        }
    }
     
    reportextension 50250 POReportExt extends "Standard Purchase - Order"
    {
        dataset
        {
            add("Purchase Header")
            {
                column(CopyRequestedReceiptDate; CopyRequestedReceiptDate)
                {
                }
                column(CopyPromisedReceiptDate; CopyPromisedReceiptDate)
                {
                }
            }
        }
     
        trigger OnPreReport()
        begin
            CopyRequestedReceiptDate.Copy(FromRecord: RequestedReceiptDate){};
        end;
    }
     
        "message": "Expected one of the application object keywords (table, tableextension, page, pageextension, pagecustomization, profile, codeunit, report, reportextension, xmlport, query, controladdin, dotnet, enum, enumextension, interface, permissionset, permissionsetextension, entitlement)",
        "message": "The name 'CopyRequestedReceiptDate' does not exist in the current context.",
        "startLineNumber": 33,
     
     
  • Suggested answer
    CU05061853-0 Profile Picture
    CU05061853-0 130 on at
    ¿Standard BC date fields not showing on PO Report when the first line is a comment?
    Thanks so much, that's great troubleshooting!
     
    Your article is helpful too, however, I don't think a report extension works in this case, since the columns are already present in the report. Unless I am going about extending it the wrong way as pictured below – I take it creating a new report instead, as a copy of the Standard Purch Order report but moving the desired fields from the Purchase Line dataitem to Purchase Header would resolve this. Then do the same for the Purchase Invoice report...
     
  • Suggested answer
    YUN ZHU Profile Picture
    YUN ZHU 74,115 Super User 2024 Season 2 on at
    ¿Standard BC date fields not showing on PO Report when the first line is a comment?
    I checked the standard code, and the two standard fields are taken from the Purchase Line. Not from Purchase Header. When you add them to the layout, the Requested Receipt Date and Promised Receipt Date in the first line should be displayed. 
    But when the type is Comment, because Requested Receipt Date and Promised Receipt Date do not exist, the first line is empty, so it cannot be displayed.
     
    This requires a little customization. You need to add the fields on the Purchase Header to the Report first and then display them without this problem.
     
     
    Hope this can give you some hints.
    Thanks.
    ZHU
     
  • CU05061853-0 Profile Picture
    CU05061853-0 130 on at
    ¿Standard BC date fields not showing on PO Report when the first line is a comment?
    HiYUN ZHU, thank you for looking into this. 
     
    There is no extension or app customisation built for it; we simply added the below standard fields that come with BC in the Word report.
     
    Purchase_Header/Purchase_Line/RequestedReceiptDate
    Purchase_Header/Purchase_Line/PromisedReceiptDate
     
    They are showing on the report—except if the first line in the Purchase Line table is of type Comment (or any type other than Item). Was hoping there is something in the Report that can be annulled through a small extension.
  • Suggested answer
    YUN ZHU Profile Picture
    YUN ZHU 74,115 Super User 2024 Season 2 on at
    ¿Standard BC date fields not showing on PO Report when the first line is a comment?
    Hi, I briefly tested it (Resource and Item), and it seems that these two dates will not be printed by default. Is the layout or report customized?
     
     
    Hope this helps.
    Thanks.
    ZHU

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

December Spotlight Star - Muhammad Affan

Congratulations to a top community star!

Top 10 leaders for November!

Congratulations to our November super stars!

Tips for Writing Effective Verified Answers

Best practices for providing successful forum answers ✍️

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 291,391 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 230,445 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans