Skip to main content

Notifications

Announcements

No record found.

Business Central forum
Suggested answer

Change description of POSTED (purchase or sales) invoices

Posted on by 185

Hello BC Forum,

The scenario is as follows:

  1. I created a purchase invoice with purchase lines G/L Accounts
  2. I did not fill in the description so Business Central fills in the description automatatically with the name of the G/L Account
  3. I posted the purchase invoice
  4. Now I want to change the description of the posted purchase lines with a customized description

 Example:

 Posted Purchase Invoice: nr 1

Purchase lines:

 G/L account       Description                        Amount

2200                     VAT                                100.75

3000                     Material                        200.50

 I want to change this into:

 G/L account       Description                                        Amount

2200                     VAT 7.7 %                                          100.75

3000                     Raw material green                        200.50

 

Is this possible and when yes (probably with configuration package): how do I configure / setup this configuration package?

Thanks in advance.

Greetings,

 John

  • JohnnyLM Profile Picture
    JohnnyLM 185 on at
    RE: Change description of POSTED (purchase or sales) invoices

    Hello SM,

    This answer is much more like what I need, but, because I did not fill in the description of my invoices, BC filled in the description of all the invoicelines with the name of the Account. So I have to update these descriptions in bulk, not one by one.

    Furthermore every bookkeeping program I know it is possible (as an administrator) to update (harmless) descriptions of posted invoices. It feels kinda strange to me that BC does not allow this and programmers have to extend such an simple but important feature.

    Greetings,

    John

  • JohnnyLM Profile Picture
    JohnnyLM 185 on at
    RE: Change description of POSTED (purchase or sales) invoices

    Hello JAngle,

    Thanks for the quick and clear reply. I tried what you suggested and changed 4 descriptions, please see my printscreens (some of them are in german). For these changes I get 4 errors. So I don't think your answer works. Or am I doing something wrong here?

    pastedimage1620642054215v5.png

    After applying the package

    pastedimage1620641971309v4.png

    Greetings, 

    John 

  • Suggested answer
    Snehanshu Mandal Profile Picture
    Snehanshu Mandal 560 on at
    RE: Change description of POSTED (purchase or sales) invoices

    Hello JohnnyLM,

    Posted transaction can not be directly modified. Even harmless fields like Description as well directly. But this is not impossible can be done a bit differently.

    I tried to create an extension for you to help you out on this. Below video shows the steps

    [View:/cfs-file/__key/communityserver-discussions-components-files/758/UpdateDescription-V1.mp4:320:240]

    For the App, I have created a new page and extended the Posted Sales Invoice Subform Page. Here is the code for the same:

    1. UpdateInvoiceLineInfo.Page.al

    page 90000 UpdateInvInfo

    {
        PageType = Card;
        ApplicationArea = All;
        UsageCategory = Administration;
        Permissions = tabledata 113 = rmid;
        Caption = 'Update Invoice Line Description';

        layout
        {
            area(Content)
            {
                group("Current Info")
                {
                    Editable = false;
                    field(InvoiceNo; InvoiceNo)
                    {
                        ApplicationArea = All;
                        Caption = 'Sales Invoice No.';
                    }
                    field(LineNo; LineNo)
                    {
                        ApplicationArea = All;
                        Caption = 'Line No.';
                    }
                    field(Description; Description)
                    {
                        ApplicationArea = All;
                    }
                }
                group("Updated Info")
                {
                    field(NewDescription; NewDescription)
                    {
                        ApplicationArea = All;
                    }
                }
            }
        }

        Procedure SetSINVInfo(SINVNo: Code[20]; SINVLineNo: integer)
        begin
            InvoiceNo := SINVNo;
            LineNo := SINVLineNo;
        end;

        trigger OnOpenPage()
        begin
            SalesInvoiceLine.get(InvoiceNo, LineNo);
            Description := SalesInvoiceLine.Description;
            NewDescription := Description;
        end;

        trigger OnQueryClosePage(CloseAction: Action)Boolean
        begin
            if CloseAction = CloseAction::LookupOK then begin
                IF NewDescription <> '' then
                    SalesInvoiceLine.Description := NewDescription;
                SalesInvoiceLine.Modify(true);
            end;
        end;

        var
            SalesInvoiceLine: Record "Sales Invoice Line";
            Description, NewDescription : text[100];
            InvoiceNo: Code[20];
            LineNo: Integer;
    }
    2. SalesInvoiceSub.PageExt.al
    pageextension 50000 SalesInvoiceSub extends "Posted Sales Invoice Subform"
    {
        actions
        {
            // Add changes to page actions here
            addlast("&Line")
            {
                action("Update Description")
                {
                    ApplicationArea = All;
                    Image = UpdateDescription;
                    Promoted = true;
                    PromotedCategory = Process;

                    trigger OnAction()
                    var
                        UpdatePage: Page UpdateInvInfo;
                    begin
                        UpdatePage.SetSINVInfo(Rec."Document No.", Rec."Line No.");
                        UpdatePage.LookupMode(true);
                        UpdatePage.RunModal();
                    end;
                }
            }
        }
    }
    Hope tis Helps. You can further extend it as per your requirement. A word of caution: don't try modifying the important fields from the invoice

    warm regards

    SM [Snehanshu Mandal]

  • JAngle Profile Picture
    JAngle 33,137 on at
    RE: Change description of POSTED (purchase or sales) invoices

    Resources to aid you: docs.microsoft.com/.../admin-how-to-prepare-a-configuration-package

    There is a search facility for the table you need - but the number you need is 123

    If you prefer learning by video try this: www.youtube.com/watch

    Process flow you will go through:

    Create configuration package

    Add table 123

    Export by excel

    Make adjustment to data in excel and save the file

    Go back to configuration package and import by excel

    Apply the data

    Check your invoice

  • JohnnyLM Profile Picture
    JohnnyLM 185 on at
    RE: Change description of POSTED (purchase or sales) invoices

    Hello JAngle, 

    Thanks for the reply. 

    I wrote: "is this possible and when yes (probably with configuration package): how do I configure / setup this configuration package?"

    So it is possible according to you, but which table / tables are involved? Where do I find my posted invoice lines descriptions? etc.

    Thanks for an answer more in detail rather then a quick general answer. 

    Greetings, 

    John

  • JAngle Profile Picture
    JAngle 33,137 on at
    RE: Change description of POSTED (purchase or sales) invoices

    Posted data wise the “editable” property of fields is determined at page or table level. In the case of “Description” at table level it is editable. A configuration package is therefore a good way to try and adjust the data. If that does not breed the required results you could get a page developed for the purchase invoice lines table which exposes the “Description” field and you can edit it

Helpful resources

Quick Links

Replay now available! Dynamics 365 Community Call (CRM Edition)

Catch up on the first D365 Community Call held on 7/10

Community Spotlight of the Month

Kudos to Saurav Dhyani!

Congratulations to the June Top 10 community leaders!

These stars go above and beyond . . .

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 287,986 Super User

#2
Martin Dráb Profile Picture

Martin Dráb 225,588 Super User

#3
nmaenpaa Profile Picture

nmaenpaa 101,148

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans