Wednesday, September 18, 2019

D365: Menu item cannot be opened

I was getting an error on my dimension group forms (Product Information Management > Dimension and variant groups > [Dimension name] group) that said the menu items could not be opened.
In the background there was also this little message saying that the system language was not set. This was happening in a Dev environment using the DAT company/legal entity.
I did a full DB sync and still got the errors. I ended up going to fill in the system language because the pop up was annoying me and that fixed the issue with the menu items.
The setting is under System Administration > Setup > System parameters.

Hope this helps!

Wednesday, September 4, 2019

Dynamics 365: Printing two reports (a docentric and ssrs report) at the same time

I was tasked with creating a "master bill of lading" report that was very similar to the bill of lading report (wmsbilloflading) with only design changes. I decided to use Docentric instead of using SSRS (which the standard wmsbilloflading uses).

There was also a requirement that when the master bill of lading was printed that all the children bill of ladings should be printed as well.

I created my own controller class to handle the reports (it extends WmsBillofLadingController). Both the bill of lading and master used the same controller class. The "print" button on the bill of lading form triggered this controller class (main method).

I created a new PrintMgmtDocumentType for my new report. Because of that, I had to add code to the initPrintMgmtReportRun() method to construct the correct printMgmtReportRun class for my new document type.

I also had to write a handler class for other print management methods that needed handled:





In the newFromArgs() method of my controller, I determined if I was printing the master bol or a standard bol based on the args().record() passed in. If the masterbol flag is on, then I needed to setup the master report; otherwise, setup the standard report:





The startOperation() method will call back into the main() method for subsequent calls to the bill of lading report. It uses the parmArgs() to pass in the new wmsbilloflading record() to print and it uses parm to tell it if we are printing a child or the master record as if it were a child and the parmObject contains the printSettings. We have to pass the printSettings() to the children since we suppress the dialog.

The startOperation() method is where the report Dialog and then report are actually called from the super() method. This is where you can catch it to display multiple reports at once.


There is an issue specific to the master being a docentric report and the children being SSRS reports. After the SSRS reports run and you go to run the Docentric master report again, the print medium now shows "screen" instead of "Docentric screen." So that the user didn't have to keep changing that, I had to add code in the loadPrintSettings() method of the controller so that if it comes in as a master and the screen type is screen, change it to screen_dc. Also, if it is not a master and it comes in as Docentric, I change it to a regular print medium type UNLESS it is screen. If it comes in as Screen, I always want it to print as Docentric screen medium type because it prints out much better to a printer than a SSRS does. 


Let me know if you have any questions.

Happy coding!