The problem and solution presented in this article are shown in a Dynamics 365 Finance and Operations/Supply Chain Management environment. This is done in an extension class, but the same principle applies to a Dynamics AX 2012 and 2009 environment, using overlayering and customizing the class, instead of extending it.
In the Tag counting page on the Mobile WMS, it is possible to create new lines on the device itself. When you enter the page it contains a list of fields in its filter, and they are already filled out from the context of the tag counting journal being added from. Sometimes this is desirable, and sometimes it is counterproductive. By design the values are inherited.
|The add tag counting line page, with an inherited value for the Location|
In this article we will change the location field name. When changing the filter field name, the inheritance from the journal is stopped, as the inheritance is by Name. When changing the name of the field, it is also changed accordingly in the document sent to the backend, and so the posting will not be able to automatically catch this name change, so we need to compensate for this as well.
The Tag Counting pages are handled in the class named MobDocTagCounting. The filter including fields are declared in the method CreateTagCountingJournalLineHeader()
This is the method we need to change the output for. In an extension (Or by overlayering) the output can be changed to look like this:
Now the name of the location has been set to "TagLineLocation" and the fourth parameter in the declaration has been changed to true, This sets a flag, that this field should be cleared, for each posted Tag Counting line.
The only thing missing now, is to make sure, that when the data is sent in, the posting logic picks up the changed field name. To ensure this make an extension to the class MobRequestItemAndDimensionElement
Here you need to make a Parm Method handling the new name of the field. The way it works is that the naming of the parm method just needs to match the naming of the field it gets the data from. The system will ensure the parm method is called with the right data, when the naming matches.
In this case, the field was called "TagLineLocation", so the new parm method, must therefore be called "ParmTagLineLocation". Add the method either in an extension to MobRequestItemAndDimensionElement, or as customization to the class itself if this is done in a AX2012.
The following example is made as an extension:
We update the existing wmsLocation variable in the parm Method. This way when the posting method to create the tag counting line executes, and queries the normal parm method for the location, that it has always used, it will contain the right data collected from the device.
After a build and a restart of the Mobile WMS app, on the device, the page does no longer inherit locations from existing lines, and the location is cleared for each posting.
|The Add Tag Counting Line after the change, with a cleared Location field|