Skip to main content

Notifications

Announcements

No record found.

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

Customer Statement (DOCX) extension

Posted on by 36
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
 
 
Categories:
  • Suggested answer
    LA-13061059-0 Profile Picture
    LA-13061059-0 36 on at
    Customer Statement (DOCX) extension
    @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.
  • Verified answer
    LA-13061059-0 Profile Picture
    LA-13061059-0 36 on at
    Customer Statement (DOCX) extension
    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.
  • DJ-30080919-0 Profile Picture
    DJ-30080919-0 28 on at
    Customer Statement (DOCX) extension
    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.
  • LA-13061059-0 Profile Picture
    LA-13061059-0 36 on at
    Customer Statement (DOCX) extension
    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

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 Suggested Answers

Best practices for providing successful forum answers ✍️

Leaderboard

#1
André Arnaud de Calavon Profile Picture

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

#2
Martin Dráb Profile Picture

Martin Dráb 230,214 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans