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)

Validation on sales order create

(0) ShareShare
ReportReport
Posted on by 6,609

Hello:

I've gotten a request to check for a validate item cost prior to allowing sales lines to be posted. Some options I've run across include using the SalesLine.createLine() to add the validation. There are a couple of other methods in SalesLine that are item specific so they may be candidates. Another option was to try and utilize the EcoResProductValidationService and add the needed logic there to check the for a valid cost. I have to test these assumptions but I'd like some feedback on them and alternatives I haven't considered.

Also, on the SalesTable form, can someone tell me where the validation (if any) are done?

Thank you very much!

*This post is locked for comments

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

    Let's first clarify what you mean by a line being posted. It seems that you're trying to validate a line before saving for the first time, nevertheless there are actual postings that may be useful for your requirement, such as a confirmation or invoice posting.

  • bankk Profile Picture
    6,609 on at

    Hi Martin,

    Yes, I misspoke. I want to validate as the sales lines are added.

  • Verified answer
    Martin Dráb Profile Picture
    237,912 Most Valuable Professional on at

    A good candidate is validateWrite() method in SalesLineType class (or its children, if the logic isn't intended for all order types).It's called for both inserts and updates, but you can check whether RecId is still empty (i.e. the record hasn't been saved yet).

  • bankk Profile Picture
    6,609 on at

    One more question if I may Martin.

    I'm looking at the InventItemPrice.findCurrent() method to determine whether a valid cost exists for the item. The problem I'm running into is the method requires a InventDimId which corresponds to the site. I've not been able to determine how the InventDimId from InventItemPrice is related to a given item from InventTable.

  • Martin Dráb Profile Picture
    237,912 Most Valuable Professional on at

    You may have different prices on different sites. Note that you have InventDimId on SalesLine.

  • bankk Profile Picture
    6,609 on at

    Thank you very much Martin.

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