web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Small and medium business | Business Central, N...
Answered

Customer Statement (DOCX) extension

(0) ShareShare
ReportReport
Posted on by 50
Hi all,
First post, we are migrating to BC next year and I am trying to learn some of the 'basic' report changes we need to do internally.
 
I think I've done the right thing on aged accounts for adding payment terms:
reportextension 80001 CustPaymentTermsExt extends /Aged Accounts Receivable/
{
    RDLCLayout = './source/reportextension/AgedAccountsReceivableFP.rdlc';
    dataset
    {
        add(Customer)
        {
            column(Payment_Terms_Code; /Payment Terms Code/)
            { }
            column(Location_Code; /Location Code/)
            { }
        }
    }
}
 
I've edited the RDLC and uploaded and that seems to be working as expected.
 
Now I am stuck with the Customer Statement, that is a Word document template.
 
I have two requirements
1. Add the Customer Payment Terms to the document
2. Replace our main Company Address information with the Location details instead.  So if the statement is running for Customers set to Location Code MAIN, the Statement needs to show the MAIN address detail.  Customers to EAST will need to show that address on their statement, and so on.
 
The first snag I've hit, trying to replicate the above for this report gives /A DataItem with name 'Customer' could not be found in the target Customer Statement./
reportextension 80003 CustStatement_FPFields_Ext extends /Customer Statement/
{
    WordLayout = './source/reportextension/FP-CustStatement.docx';
    dataset
    {
        add(Customer)
        {
            column(Payment_Terms_Code; /Payment Terms Code/)
            { }
            column(Location_Code; /Location Code/)
            { }
 
 
 
Any help appreciated!
 
Kind Regards, Luke
 
 
I have the same question (0)
  • LA-13061059-0 Profile Picture
    50 on at
    I have figured out the Payment Terms - I was using the wrong variable for what is extended.
    I now have it working using 
    reportextension 80003 CustStatement_FPFields_Ext extends /Standard Statement

    Now I am just working on the Location Address/Contact details to show instead
  • DJ-30080919-0 Profile Picture
    34 on at
    Hi Luke Argent,
     
    you can do like this. get the location details under customer dataitem using OnAfterAfterGetRecord trigger.

    dataset
        {
            add(Customer)
            {
                column(Location_Name; Location.Name) { }
                column(Location_add; Location.Address) { }
                column(Location_add2; Location."Address 2") { }
            }
            modify(Customer)
            {
                trigger OnAfterAfterGetRecord()
                begin
                    if not Location.Get(Customer."Location Code") then
                        Clear(Location);
                end;
            }
        }
        var
            Location: Record Location;
     
    Hope this will help you.
  • Verified answer
    LA-13061059-0 Profile Picture
    50 on at
    Hi Dhana
    Thanks for your response.
    I need to try and learn all the differences to "add" !
     
    I found a Learn guide that had some suggestion on linking, I did this - seems to work. (for everything on my original post)
     
    reportextension 80003 CustStatement_FPFields_Ext extends "Standard Statement"
    {
        WordLayout = './source/reportextension/FP-CustStatement.docx';
        dataset
        {
            add(Customer)
            {
                column(Payment_Terms_Code; "Payment Terms Code")
                { }
                column(Location_Code; "Location Code")
                { }
            }
            addlast("Customer")
            {
                dataitem(Location; Location)
                {
                    DataItemLink = "Code" = field("Location Code");
                    column(Name; Name)
                    { }
                    column(Address; Address)
                    { }
                    column(Address_2; "Address 2")
                    { }
                    column(City; City)
                    { }
                    column(County; County)
                    { }
                    column(Post_Code; "Post Code")
                    { }
                    column(Phone_No_; "Phone No.")
                    { }
                }
            }
        }
    }
     
     
     
     
    I will give your method a go, we will be batching scheduled emails, so not sure if either method has an impact on that.
  • Suggested answer
    LA-13061059-0 Profile Picture
    50 on at
    @Dharna Jude
    Your reply works, I've been trying to select it as the answer but Edge just hangs. When I select another reply it will accept them as the answer!
     
    Thank you for your help.

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

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

Leaderboard > Small and medium business | Business Central, NAV, RMS

#1
OussamaSabbouh Profile Picture

OussamaSabbouh 3,010

#2
Jainam M. Kothari Profile Picture

Jainam M. Kothari 1,270 Super User 2025 Season 2

#3
YUN ZHU Profile Picture

YUN ZHU 1,085 Super User 2025 Season 2

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans