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 :
Microsoft Dynamics AX (Archived)

OnInserting not firing on a table

(0) ShareShare
ReportReport
Posted on by

I've added a few fields through a table extension, when a record is inserted into the table I want to populate those fields with some data prior to the insert.

I've created a static class and added the event to it, but it doesn't fire, My breakpoint in visual studio never gets hit and the data doesnt show up in the table.  I've done all of the normal, database sync, reboot, etc.

static class MyRetailGiftCardTransactionsEventHandlers

{
[DataEventHandler(tableStr(RetailGiftCardTransactions), DataEventType::Inserting)]
public static void RetailGiftCardTransactions_onInserting(Common sender, DataEventArgs e)
{
RetailGiftCardTransactions r = sender as RetailGiftCardTransactions;
r.myCustomField ='1234';
}

}

Anyone have any input?

*This post is locked for comments

I have the same question (0)
  • Suggested answer
    Mea_ Profile Picture
    60,286 on at

    Hi Daniel Budimir,

    Thats probably because retail guys do not like inserts, they do "doInsert" because of some strange reason, so your event won't be triggered.  You need to find a place where record gets inserted into DB and add your code there, it could be multiple places, cross references and debugger will help you. One of them is RetailGiftCardTransactions::add().

  • DanAx Profile Picture
    on at

    Thanks for answering ievgen, I can get a prehandler for the add method but that doesn't buy me much as far as I can tell.  Any other suggestions?  I'm calling retailtransactionservice which in turn calls retailtransactionservicetransactions so I'm having some trouble getting to that object.

  • Verified answer
    Mea_ Profile Picture
    60,286 on at

    You definitely need to go back to MS and ask for extension points. That is the issue they have and they need to fix it. As a stupid work around you can do post handler to RetailGiftCardTable::createCard, set the fields and call update, it's extra DB call but you have no other choice.

  • Suggested answer
    Community Member Profile Picture
    on at

    Hello

    I also had this problem but fortunately solved it.

    You can use the following:

    "ttsbegin;

    r.myCustomField ='1234';

    ttscommit:"

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 > 🔒一 Microsoft Dynamics AX (Archived)

#1
Pratik Bhosle Profile Picture

Pratik Bhosle 2

#2
Giorgio Bonacorsi Profile Picture

Giorgio Bonacorsi 1

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans