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!