web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

No record found.

News and Announcements icon
Community site session details

Community site session details

Session Id :
Finance | Project Operations, Human Resources, ...
Unanswered

Data not getting selected in the event handler of table

(0) ShareShare
ReportReport
Posted on by 25

I had a requirement where I have to update a inventdimid whenever creating a new batch/production order in prodbom table . I have wrote the logic in oninserting event handler of prodbom table. I tried to debug a code (attached snapshot)

20230116_5F00_225636.jpg

In the line ProdBom peodbomup =sender as ProdBom, it is not selected a data, value is null. It would be great help if if anyone suggests a solution.

Thanks

I have the same question (0)
  • Martin Dráb Profile Picture
    238,749 Most Valuable Professional on at

    I don't know what the problem is, but can't you avoid the whole situation by simply using CoC?

    By the way, I see you're trying to update a record that hasn't been inserted yet, which would obviously fail. Just set the value and don't call update(); let the system to insert the record.

    With CoC, the code will look somehow like this:

    void insert()
    {
        this.InventDimId = BOM::find(this.BOMId).InventDimId;
    
    	next insert();
    }

  • Vidhi_234 Profile Picture
    25 on at

    Thanks and noted the point for update(). But I'm working on standard table and form, I need current instance of the table. How can I achieve that. Sender as table is not selecting any Data.

  • Martin Dráb Profile Picture
    238,749 Most Valuable Professional on at

    Are you saying that you think that my code can't be used for a standard table, because you aren't aware of CoC at all? :-o

    If so, I have some great news for you...

  • Vidhi_234 Profile Picture
    25 on at

    Actually I'm a newbie,  didn't used Coc before.

  • Martin Dráb Profile Picture
    238,749 Most Valuable Professional on at

    CoC (Chain of Command) is an absolutely crucial topic for extensiblity. It's an easier and more powerful way for writing extensions. You define an extension class and override methods. Such a method has the same name and parameters as the method you're extending (such as insert()). You'll use the next keyword to call the base method, and put code before or after this next call to execute code either before or after the standard logic.

    You can refer to the current object by this.

    You can see all these things in my example above.

    You can also easily refer to class variables or form controls by name, you can access protected members, add methods, add class fields and so on.

    Please read Class extension - Method wrapping and Chain of Command in F&O documentation.

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

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Stars!

Congratulations to our 2025 Community Spotlights

Thanks to all of our 2025 Community Spotlight stars!

Leaderboard > Finance | Project Operations, Human Resources, AX, GP, SL

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 510 Super User 2026 Season 1

#2
Giorgio Bonacorsi Profile Picture

Giorgio Bonacorsi 399

#3
Adis Profile Picture

Adis 251 Super User 2026 Season 1

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans