Hi,
I am having a difficult time converting a AX 2012 customization to work the same in D365. We have some validation code on the Post journal clicked method in AX that if certain condition is met then it throws an error and halts the execution of the posting process.
I tried CoC and Event handler but I just cant stop the posting. With CoC I run my validation first on the clicked method then compiler throw error that next call must be run unconditionally, if i create a event handler for OnClicked event it first run the super() method that result in running posting before my handler code.
Any suggestions/ideas?
Hi Samy123,
Could you please share your code in AX 2012 and in which form you had it? It will be helpful in determining where we could use it in D365 F&O.
Form: ProdJournalTable
Button: Post, method: Clicked()
Custom code is before call to super()
ProdJournalBOM prodJournalBOM;
while select prodJournalBOM
where prodJournalBOM.JournalId == prodJournalTable.JournalId
{
if(prodJournalBOM.TransDate > today())
error("Posting error");
return;
}
CoC should work fine if you still want the validation logic in the clicked method. Please share the code you tried for CoC. Maybe we can see the issue there.
It might be better if you move the validation to ProdJournalCheckPost class.
You can give a try to hide the button itself on active method of form. Use COC and extend the active method of form.
Putting such logic to clicked() is a bad idea. Journals posting already support validation, you can even run validation without posting to check if data in the journal is all right. You sholuld add your logic there.
Look at check* methods in ProdJournalCheckPost, e.g. checkProdTable().
Thanks Martin! this seems to be the best way of achieving it., In AX we were spoiled and used to take shortcuts to get things done :) D365 is more strict on that.
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.
As AI tools become more common, we’re introducing a Responsible AI Use…
We are honored to recognize Abhilash Warrier as our Community Spotlight honoree for…
These are the community rock stars!
Stay up to date on forum activity by subscribing.
CA Neeraj Kumar 2,167
André Arnaud de Cal... 867 Super User 2025 Season 2
Sohaib Cheema 617 User Group Leader