Skip to main content

Notifications

Microsoft Dynamics NAV (Archived)

Extending custom table

Posted on by 215

Hello there.

I need to extend the Purchase Header table via extensions using AL.

I want to add a check when the end user modifies the Buy-from Vendor. I want to check the value of a custom field (what is standard with the status Field).

So I went around the events route.

I captured the events that get thrown when this happens and I found the 

OnBeforeValidateEvent.
SO I created a codeunit . This even does not seem to do much for me because I can not pass a record to it, so I can not check the value of another field. Var POheader is not part of the event variables. Any ideas on how do I accomplish my requirement.
Codeunit 50000 "Mysubscriber"
{
[EventSubscriber(ObjectType::Table, 38, 'OnBeforeValidateEvent', 'Buy-from Vendor No.', true, true)]
Local procedure CheckContractno(Var poheader: record "Purchase Header")
begin

    //my code here.

end;

}

*This post is locked for comments

  • Armela Kamenica Profile Picture
    Armela Kamenica 215 on at
    RE: Extending custom table

    Thank you so much.

    That is exactly what I was looking for.

    Thanks

  • Verified answer
    Binesh Profile Picture
    Binesh 7,885 on at
    RE: Extending custom table

    Hello Armela,

    The event you subscribed that will give you 3 parameters as below:

    var Rec: Record "Purchase Header";
    var xRec: Record "Purchase Header";
    CurrFieldNo: Integer
    So you can write your business logic based on these variables, even though if it's not meet your requirement then you have to subscribe other field that you have to check.
    below are the code for your reference
    4452.2.png

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,253 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 230,188 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans