Announcements
Hi
I have created one class for writing some custom code, I want to execute that methods in class just after creation of sales/purchase orders or just after creation of Project (like we filled details & hit create button just after that logic must be executed)
is their any specific methods or events on forms which let us execute our code just after these events.
Thanks,
Harshit
Hi Harshit,
You can create event handler methods in a class which subscribes to the table OnInserted events for the tables which should trigger your coding.
Hi Harshit, As Andre mentioned, you can create post event handler for table insert as specified in below article.
www.d365snippets.com/.../event-han.html
Also, you can use Chain of Command on table insert method
https://dynamics365musings.com/chain-of-command-table-methods/
Hi,
What is important to consider, is when your code should be executed. Because if all order lines should be processed, it doesn't make sense to add run the custom when the order header is inserted, but rather when the order is confirmed for example. Or some other process event.
Hi Andre & Mohit,
It worked, Thanks for sharing the Reference.
Hi Anton,
Thanks for the suggestion.
Yes I must consider this while creating a sales/purchase order but where I can add my logic, which event needs to subscribed.
but what if I am creating a project & I need some fields from billing Rules lines (LineValue, Default Dimension) ) to create journal lines for a journal , In that case I can execute the logic just after creation of project Header because for that I just need ProjId & ProjInvoiceProjId of newly created project, with these data I can easily fetch the Billling Rules from PSAContractLineItems Table.
So, Is it not feasible to run my logic in OnInserted event of ProjTable.
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.
Jump in, show your community spirit, and win prizes!
Expanding mentorship, skilling, and AI innovation
These are the community rock stars!
Stay up to date on forum activity by subscribing.
Abhilash Warrier 461 Super User 2026 Season 1
André Arnaud de Cal... 428 Super User 2026 Season 1
Subra 428