Skip to main content

Notifications

Business Central forum
Suggested answer

New column with first line description - Vendor Ledger Entries

Posted on by 160

Hi mates

It's me again! Need your help.

I created a new column (Custom Description) on Vendor Ledger Entry table and Vendor Ledger Entries page.

Now, I want that this new column show the first line of description depending on document type (or not)

I tried the next on Table:

        field(79003; "Custom Description"; Text[100])
        {
            Caption = 'Custom Description';
            Editable = false;

            // FieldClass = FlowField;
            // CalcFormula = lookup("Purch. Inv. Line".Description where("Document No." = field("Document No.")));
        }

Ignore the bars please. Whit that, I only have Purch. Inv. Line description.

The next I tried was (on Page) to classify by serial number because I can't compare Enum (Document Type) like String:

pastedimage1655367469943v1.png -> Operator '=' cannot be applied to operands of type 'Enum "Gen. Journal Document Type"' and 'Text'

     
    var
        CustDescFac: Record "Purch. Inv. Line";
        CustDescAb: Record "Purch. Cr. Memo Line";

    trigger OnAfterGetRecord()

    Begin
        if SerialNumber = 'C-FAC+' then
            CustDescFac.Description := Rec."Custom Description";
        if SerialNumber = 'C-AB' then
            CustDescAb.Description := Rec."Custom Description";

    end;

And need something that check or put every line.

Any ideas?

Thank you so much! :D

  • Suggested answer
    Nitin Verma Profile Picture
    Nitin Verma 21,023 Moderator on at
    RE: New column with first line description - Vendor Ledger Entries

    What else you are looking for?

  • Suggested answer
    Vaishnavi J Profile Picture
    Vaishnavi J 3,056 on at
    RE: New column with first line description - Vendor Ledger Entries

    Hi,

    if you have written the above logic on separate page and not page extension you can write the below logic.

    Also in the page you have to give the permission to modify the posted tables. Refer the screenshot.

    Permission = tabledata "Purch. Inv. Line" =rim, tabledata "Purch. Cr. Memo Line"=rim;

    pastedimage1655388890995v1.png

      var

          CustDescFac: Record "Purch. Inv. Line";

          CustDescAb: Record "Purch. Cr. Memo Line";

      trigger OnAfterGetRecord()

      Begin

          if rec."Document Type" = Rec."Document Type"::Invoice then

              CustDescFac.Validate(Description, Rec."Custom Description");

              CustDescFac.modify(true);

          if rec."Document Type" = Rec."Document Type"::Refund then

              CustDescAb.Validate(Description,Rec."Custom Description");

              CustDescAb.modify(true);

      end;

    Also can you describe how are you going to fill the value on this custom field in VLE?

    If my answer was helpful to you, please verify it so that other users know it worked. Thank you very much

  • JMartin Profile Picture
    JMartin 160 on at
    RE: New column with first line description - Vendor Ledger Entries

    Thanks mate :) One problem solved but still not working :(

       var

           CustDescFac: Record "Purch. Inv. Line";

           CustDescAb: Record "Purch. Cr. Memo Line";

       trigger OnAfterGetRecord()

       Begin

           if rec."Document Type" = Rec."Document Type"::Invoice then

               CustDescFac.Description := Rec."Custom Description";

           if rec."Document Type" = Rec."Document Type"::Refund then

               CustDescAb.Description := Rec."Custom Description";

       end;

  • Suggested answer
    Nitin Verma Profile Picture
    Nitin Verma 21,023 Moderator on at
    RE: New column with first line description - Vendor Ledger Entries

    Hi,

    you can compare your Document type like beow

    if Rec."Document Type" = Rec."Document Type"::Invoice then

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

Anton Venter – Community Spotlight

Kudos to our October Community Star of the month!

Announcing Our 2024 Season 2 Super Users!

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

Dynamics 365 Community Newsletter - September 2024

Check out the latest community news

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 290,524 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 228,493 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,148

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans