Friday, October 18, 2019

D365: warehouse locations data migration

When using the standard warehouse locations data entity, I kept getting an error that the "Field WarehouseAisleId must be filled in."

This is odd because the wmslocation table, the entity and the staging table all have the Mandatory property set to "No" for this field.

While investigating, I found that in the WhsLocationBuild class, "createNewLocation()" method, the system sets wmsLocation.aisleid to '--' (yes, it's hard-coded, sigh).

Also, the data entity specifically checks that the field is filled in during the validateWrite() method. To get around this, I added:
'--' as WarehouseAisleId
to my script that exports the data out of my legacy application.

Hope this helps!

Tuesday, October 8, 2019

D365: getting a drop-down/lookup for a new field on a table

So you have a new table that you want to associate with InventLocation. You create the table and add a field to the table. Let's call it TestTable and the field is GroupId. Now you want to add groupId to the inventLocation table and add it to the inventLocation (warehouse) form and get the drop down to show all the groupIds in the TestTable to choose from.

In TestTable, create an index with your GroupId field in it. It should not allow duplicates and it should be used as the primary and clustered index of your table.

Now go to the InventLocation table and create a new relation, choose foreign key relation as the type of relation you are adding. The related table should be TestTable and then choose your index that you created as well.

Once you save this, it will add a field to InventLocation for you and will also create an Index for you. If you want to allow duplicates in InventLocation, you will have to go to the index it created and set allowDuplicates to Yes. You can delete the index if you don't want it though.

That's it!

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!





Thursday, August 1, 2019

Dynamics 365 - Breakpoint will not be hit. Symbols have not been loaded. . .

I looked all around for a resolution to this problem and everyone pointed to the same setting.
Under Dynamics 365 > Options :
Make sure under the Dynamics 365 > Debugging section, make sure that "Load symbols only for items in the solution" is NOT checked.

So I did that, but still continued to get this error when attempting to debug.

There is another setting that you need to check.

It is in VS under Tools > Options. Go to the Debugging > Symbols section and make sure that Automatically load symbols for :
"All modules, unless excluded" is selected!