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)

Adding a stop dialogue box

(0) ShareShare
ReportReport
Posted on by 495

Hello Experts, am back it again with AX 2012....

I have a situation where for some reason items are coming out with unit price a 0.00. on the sales order line. Now I have a requirement to ensure this doesnt happen. Is there a way to put a stop dialogue box on a sales order line if an item price is 0.00? This is to prompt the user that they need to call Sys Admin to before they can confirm the order. All suggestions help is greatly appreciated.

*This post is locked for comments

I have the same question (0)
  • Sohaib Cheema Profile Picture
    49,677 Super User 2026 Season 1 on at

    In the sales confirmation class there is a validate method. you can customize that if you are in AX2012. for D365 you can extend that using post event handler or using COC

  • Lionel07 Profile Picture
    495 on at

    Hello Sohaib, thanks for you response.... are you referring to the class SalesConfirmJournalCreate class? I have search most of the classes and cannot seem to find tha validate method to which you speak.  I am using AX 2012 R2

  • Sohaib Cheema Profile Picture
    49,677 Super User 2026 Season 1 on at

    My apologies for not having a look of the AOT.

    Can you see there a method named checkDiscardLines..?

    Also it should allow you to override check method.

  • Lionel07 Profile Picture
    495 on at

    Yes that is there but when I added the calidation code, confiormaton is still printing

    if (salesParmLine.LineAmount<= 0)

       {

           return true;

       }

       // LF CODE TO CHECK LINE AMOUNT

       if (saleslines.salesPrice <= 0)

       {

           return true;

       }

  • Sohaib Cheema Profile Picture
    49,677 Super User 2026 Season 1 on at

    You are returning True which seems doubtful to me, though i can be wrong here. Can you please try something as under?

    If(saleslines.salesPrice)

    {

      return checkFailed('Any message that you may want to display.');

    }

    Also note that you may take care for case of Return Orders in your IF condition.

  • Lionel07 Profile Picture
    495 on at

    Thanks much Sohaib, this is very complicated stuff besides am only started learning to code in AX.  I have sorted it our without having to write code but now am in a another problem. My solution works for the sales order but for the sales agreement am having serious problems. Could you be so kind in helping me find where i can drop some code or modify some methods to ensure all values entered in the unit price for a sales agreement is more than 0.00? i have to do this for the sales agreement because user enter the unit price manually. Now I only need some help in figuring out how to get to validate the control (ALine_AgreementLineQuantityCommitment).PricePerUnit so that a value greater than 0.00 is always entered.  

    Am not even seeing the table (ALine_AgreementLineQuantityCommitment) in AX

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!

Meet the Microsoft Dynamics 365 Contact Center Champions

We are thrilled to have these Champions in our Community!

Congratulations to the March Top 10 Community Leaders

These are the community rock stars!

Leaderboard > 🔒一 Microsoft Dynamics AX (Archived)

#1
Basit Profile Picture

Basit 1

#1
GL-01081504-0 Profile Picture

GL-01081504-0 1

#1
Roya Profile Picture

Roya 1

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans