How can I automatically click on a prompt on SalesEditLines form?

Question Status

saman0suke asked a question on 16 Apr 2013 4:41 PM

Hi, I'm on DAX 2012, and I'm doing some modifications in the SalesEditLines form, when I'm going to pick a sales order, I click on the button "OK" at the bottom of the form, and I get this:


How can I click on "Yes" button in the prompt, by code? I already did an override on the click event for the OK button and tried to use a Macros to simulate an Enter on the keyboard, but it does not work, is there any way to do it? Thanks!!

Dominic Lee responded on 17 Apr 2013 12:05 AM


If you are going to force an "Ok", then why not edit the code to skip this prompt instead? (maybe under some condition base on your modification.)


saman0suke responded on 17 Apr 2013 7:24 AM

I haven't been able to find where this prompt is being created, the SalesEditLines form is a "system" form, and it goes through many classes, methods, I tried to debug it to see where it was being generated, but I haven't had any luck so far, thanks!

Kambiz Nasehi responded on 17 Apr 2013 11:04 AM

By doing setup a printer (using "Printer Setup" button) to print out to some where rather than the screen you will get out of this warning. At the same way, in case the print out goes to screen for copy or original print the printout is always "After" which you can change it to "Current" as well.

As a thought, by modifying the errors and warning specially while are working in posting journals environment you are about to violate the user actions so I do not recommend to do this but there is way to do so.

saman0suke responded on 17 Apr 2013 2:38 PM

I understand this might not be a good way to avoid prompts, however I've been asked not to use this prompt, and the report has to be printed in the screen, instead of another output.

If I change the print from "After" to "Current" I get a warning that says "Current is not allowed when printer settings are set to a client target". Any ideas? thanks!!

Kambiz Nasehi responded on 17 Apr 2013 4:25 PM

In here, "Not to use this prompt" or "automatically click on" overall means that "avoid prompts" as long as you are about to bypass a user action and notice !

"Connect to printers on this server" can be set in the Microsoft Dynamics AX Client Configuration Utility.

Anyway, such this warning message comes from a derived controllers class.A container that contains a "SrsReportPreRunState" enumeration value along with a message to display to the user. You might take a look at "preRunValidate" method inside "SrsReportRunController" and (in this case)  "ProdPickListController". However  a common use of this method is to validate whether the time taken to run the report is accepted, however could be a start point for tracking.

Dominic Lee responded on 17 Apr 2013 6:42 PM

Hi Sam,

The code which trigger this dialog appears to be in \Classes\SalesFormLetter\validate method. Unless you need to override this behavior in all types of postings, modifying the override at the subclass (or create an override if there isn't one) can be a better option.

FYR, I found this location by:

1) Look for the Label ID for the prompt using Label Editor.

2) Once found, click "Used by" button on the Label Editor

3) Only one entry found using this label!

When the cross reference works so well, it's a beauty isn't it? =D