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

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Microsoft Dynamics AX (Archived)

Inventory transactions(Sales,Purch,Movement and etc) validation for Item

(0) ShareShare
ReportReport
Posted on by

Hi All,

I'm facing issue to find place where I can add validation for InventTable one new field.

If it is not filled, I should not allow any Invent transaction. Is there any place/class where I can put validation on one place and it would check on every process. If it would be Sales Order, Purch Order, Inventory Movement and so on?

Or I should add validations separately for all processes?

*This post is locked for comments

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

    If you don't want to allow any inventory transaction just throw exception on insert of InventTrans table, but do you really want this ? It sound strange.

  • Mantas Vysniauskas Profile Picture
    on at

    Client wants :) Not me :)

  • Sohaib Cheema Profile Picture
    49,438 User Group Leader on at

    I don't think if data is ever inserted directly in InventTrans.  As you said yourself it comes though sources (PO, SO lines etc.)

    So how about making fields mandatory in source location and as validation you can put validation on InventTans using TransactionType

  • Mantas Vysniauskas Profile Picture
    on at

    The point is I don't want to touch sources. I want to add only one validation on the main connecting place. For example like ievgen Miroshnikov said, to add on InventTrans validateWrite. i'm testing it now. But also not sure how it will effect source if InventTrans will be not valid.

  • Verified answer
    Vilmos Kintera Profile Picture
    46,149 on at

    The bad news for you is that insert operations do not require a TTS transaction block, thus throwing an error is not going to help in many cases, because there is no transaction to roll back during record creation for InventTrans.

    You could try to override the aosValidateInsert method and throw an error there on InventTrans which is being called no matter what (insert/doInsert), unless AOS validations are explicitly turned off in code (which is very rare). But that is not going to ensure that the creation of the parent record (origin, through InventTransOrigin) is not being inserted, and you are potentially going to end up with broken record references.

    The only possible way to do this correctly is by identifying that in which scenarios do you want to prevent creating an inventory transaction, and change each and every places where you want to raise the error (such as SalesLineType, PurchLineType, various inventory movement classes, etc.).

    Due to this I would tell the customer that this is technically not feasible or worth the effort, and would be too much effort to implement it and maintain the customization for future hotfixes and upgrades..

    As an alternative solution, when the product is released, during validation you could check if your mandatory fields are filled in and if not, you could put the product on hold for specific transaction types. I believe that is set in the "Default order settings" and "Site specific order settings" on the product.

  • Mantas Vysniauskas Profile Picture
    on at

    Thanks for your comments. Now I think I know what to do :)

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

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

Leaderboard > 🔒一 Microsoft Dynamics AX (Archived)

#1
Martin Dráb Profile Picture

Martin Dráb 4 Most Valuable Professional

#1
Priya_K Profile Picture

Priya_K 4

#3
MyDynamicsNAV Profile Picture

MyDynamicsNAV 2

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans