Skip to main content

Notifications

Announcements

No record found.

Microsoft Dynamics 365 | Integration, Dataverse...
Unanswered

Lookup trought trigger - Change field value

Posted on by 160

Hi mates :)

I need your help. Mi idea is to change the description value on General Ledger Entries (or create a new one if I can't) depending on the document type.

For example, if Document Type is "Invoice", I want to put the description of the first line of the invoice.

If document type is "Credit Memo", I want to put the desription of the first line of the memo.

I tried something like this but didn't work, could you help me? Thanks :D

pageextension 79130 GeneralLedgerEntries extends "General Ledger Entries"
{
    layout
    {
        addafter("Document No.")
        {
            field("Desc2"; rec.Desc2)
            {
                ApplicationArea = all;
                Caption = 'Desc. Line';
                trigger OnAfterLookup(Selected: RecordRef)
                var
                    Inv: Record "Purch. Inv. Line";
                    CMemo: Record "Purch. Cr. Memo Line";
                begin
                    if rec."Document Type" = 2 then
                        Rec.Desc2 := Inv.Description;
                    if rec."Document Type" = 3 then
                        Rec.Desc2 := CMemo.Description;
                end;
            }
        }
    }

}
  • JMartin Profile Picture
    JMartin 160 on at
    RE: Lookup trought trigger - Change field value

    Any ideas?

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,235 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Product updates

Dynamics 365 release plans