Code highlighting

Showing posts with label Dynamics AX 2012. Show all posts
Showing posts with label Dynamics AX 2012. Show all posts

Friday, November 04, 2016

Tutorial Link: Executing outbound work with pending demand replenishment work

Introduction

In Dynamics 365 for Operations we solved one of the long-standing complaints, where large work orders could not be started because of pending replenishment. A typical workaround then would be to artificially broke down the replenishment lines into a separate work order, so workers can do the picking for the majority of stuff. Then of course you'd get into problems with merging the two (or more) Target LPs onto one (which we now also support - see my previous blog post).

Read the feature description and and walk through a sample flow on our SCM blog:
https://blogs.msdn.microsoft.com/dynamicsaxscm/2016/11/04/processing-work-that-is-awaiting-demand-replenishment/

For those on AX 2012 R3

We have not back-ported this feature to AX 2012 R3 yet. We have it in the backlog, but no ETA for when that will happen.

Update: This is now available on LCS under KB3205828

Feedback

We'd love to hear your feedback on this feature if you are going to use it in your production environments.



Monday, May 11, 2015

Tutorial: Caching display methods

Overview

Caching is an important part of the Microsoft Dynamics AX application. It allows us to significantly speed up certain processes by avoiding redundant round trips to the server and the database. Display/Edit methods are a good example of where caching is helpful, as it significantly increases the overall responsiveness of a form.
In AX 2012 R3 there are a number of ways you can specify that a display method needs to be cached. Below is a list, as well as a brief description and an xpo with a tutorial form to show the various options.
  • Invoke cacheAddMethod(MethodName) in the init() method of the data source
This is the only option that was available in older versions of Dynamics AX.
All cached data methods are calculated and cached in executeQuery of the data source they belong to. That is why it is important to call the above method in the init() of the data source, once the data source is initialized, but the data hasn't been retrieved yet. The optional second parameter controls whether or not the display method value should be refreshed when data is written to DB
  • Add the SysClientCacheDataMethodAttribute attribute on the display method
Now that attributes are available, caching a display method is as easy as adding an attribute on the method. It has an optional parameter same as the above method. Note, that marking a display method with this attribute will mean that it is cached on all forms the method is used on. So make sure that is what you want to happen before adding it.
  • Set the “Cache data method” property on the display method form control to Yes
This is, again, a new capability in the latest version of AX, that is pretty much identical to calling the cacheAddMethod, just much easier.
  • Set the “Cache data method” property on the display method form control to Auto, where the data source is read-only
Now, this is something that is done automatically by the kernel. If the data source which the display method belongs too is read-only, and Cache data method property on the corresponding control is set to Auto, the kernel will cache this method. This is smart, as the value can’t really change. You can still change the property to No, if there’s a reason why you want the display method not to be cached.

Additional info

On top of the above, I would also like to mention a few other things.

  • There are 2 kernel-defined methods, called titleFields and parentTitleFields, which are always being cached automatically by the kernel. The titleFields method corresponds to the 2 Title Fields that you can set on the table level. Then, if you have this table as your TitleDatasource on the form design, the 2 fields selected will be shown in the caption of the form. parentTitleFields is very similar, only it displays the title fields of the parent data source table, which is relevant in a header-lines (dynalinked datasources) kind of scenario. As a fallback, it shows the titleFields.
  • There are methods for managing the cached methods, one of them being cacheCalculateMethod, which asks the server to re-calculate the method value and update the cache for the current record. Note that it will only take effect if the method has previously been cached. In the tutorial project I am using this method in the form method runHack to refresh the value of 2 of the display methods. 

Example

You can download the xpo project with the tutorial from my OneDrive.
Upon opening the form in the project, some data will be pulled into the form. More specifically, the first 3 items/customers/vendors/sites/warehouses. For each of them a display method is present, and one of the above approaches is used to cache it.

Step 1



None of the display methods are cached. As you can see, nothing extra was done in executeQuery of the main data source, but itemName was cached for all 3 records for the read-only data source, as the control has "Cache data method" property set to Auto. This happens even though the tab page is not the active one, so it wasn't really yet necessary to calculate these values. Maybe the user won't even navigate to that tab page. You should consider this carefully when designing a form, and always aim at increasing the overall responsiveness of a form by only executing the appropriate display methods.

Step 2 and 3



inventSiteName and vendName were cached (through one of the options above). As you can see, now their values are calculated once for each of the records shown. InventLocationName and custName are still not cached.
Clicking on Refresh result button will show any extra calls to the display methods since the form started. As you’ll quickly notice, the non-cached methods are being called every time something hints at covering up the value of the control, or rather every time AX thinks it needs to recalculate the value, which is VERY OFTEN. That should make it pretty clear how useful caching is for display methods.

Step 4



Now inventLocationName was also cached, and the only method that is remaining and not cached is custName. You can see how more and more methods are executed in one batch on the server as part of the executeQuery method on the data source.

Step 5



As the last step, I have added 2 standalone controls that show the Title fields of the main data source table, and started logging the time method caption is invoked. As I have written above, titleFields and parentTitleFields are cached automatically, but you can't really see it, as it is not possible to override it. caption is the closest you can get to it, so I figured it's worth showing that. You can see the method is evaluated right after all data source queries have executed (as it relies on the currently selected record). It is evaluated first time based on the selected data source record, and then again when focus actually goes to the grid, so that the first record is explicitly selected. It will be invoked again whenever the active record changes. Note that unlike custName method, it does not get constantly refreshed.

Play around with the form and let me know if you have any questions or comments.
Thanks

Friday, January 16, 2015

Tutorial: InventDimCtrl_Frm classes and the amazing things you can do with their help

Preamble

I was making some adjustments to one of the forms in the application today. Specifically, it was the PdsCustSellableDays form, which is a setup form you can open for a selected customer through the Sell\Setup\Sellable Days action pane button. You can read more about this functionality here:

Working on these changes brought back the memory of what it is that I have always enjoyed most about developing customizations in AX: Making a lot of difference with only a few small targeted code changes.

So I was inspired to use this as an example for describing some of the capabilities of the InventDimCtrl class hierarchy. There are a lot of classes in the hierarchy, targeted to various forms in the application that display Inventory dimensions one way or the other. The main purpose of this class hierarchy is to control the display and behavior of the inventory dimensions as well as the “Dimension display” button that is normally also present on such forms.

Most of you probably know that the way AX developers early on decided to handle inventory dimensions is through a “reference” table InventDim, and a lot of generically written code that would heavily exercise reflection and traversing form controls. This seemed like a good idea at that time, I bet, but over the years, in my opinion, it got completely out of control, and now is a pretty large overhead for almost all inventory related operations in our product. But, at the same time, it provides a nice level of flexibility to how dimensions are displayed on a particular form.

That being said, let’s start from the beginning and briefly explain the existing form behavior and the things I was set to change in it.

Existing behavior and task

Overview of the existing behavior

  • Only product dimensions are displayed in the main grid
  • The relationship to the products is implemented via a “standard” pattern of TableGroupAll. So you can set up Sellable days for a specific item, an item group, or all items.
  • Viewing Inventory\Dimension display shows the standard dialog with all inventory dimensions. However, storage and tracking dimension check-boxes are disabled for editing.
  • Upon adding a grid row and selecting a released product master, all product dimension values are shown, not just those from the released product variants.
  • Only the product dimensions active for the selected product are enabled for editing. If Item code is set to Group or All, all the dimensions are disabled for editing.

Original version of the form

Task

  • Storage and tracking dimensions cannot be selected in Dimensions Display, so should not be shown at all
  • Lookup for configuration and other product dimensions should only show those relevant for the released product master.

 

Explanation

OK, so let’s take a closer look at how such types of forms are built

  • A form-level variable of type InventDimCtrl_Frm is declared. This object is used to control the behavior of the inventory dimension controls on the form.
  • A form method called inventDimSetupObject simply returns the above reference. Through this method other AX forms and classes can access the current state of the form when it comes to the dimensions
    • This includes information about which inventory dimensions are visible in the grid, which of them are enabled for editing, which of them should be marked as mandatory, which of them should be shown when the Dimension Display button is pressed, whether or not the “large” version of the dialog is to be shown (that includes On-hand information like Closed/ClosedQty), whether Item number should be shown on the Dimension Display dialog, etc.You can browse the methods on this class to get a feeling for what else it can do.
    • Since we can only select product dimensions in the form, we want spread that over to the Dimension Display dialog as well.
  • A form method called updateDesign() exists, with a certain pattern for handling various “events” that happen on the form. The main purpose here is to update the inventDimSetupObject with the latest information from the form, and through it refresh the display of the inventory dimension controls.
    • In the PdsCustSellableDays form this happens when the form is opened (Init), whenever the item code or reference is changed (FieldChange), whenever the active record is changed (Active) or whenever the parent customer record is changed in turn refreshing the Sellable Days view (LinkActive).
      • This method is then called from the appropriate event handles or the form, as you can see if you open the form code.
    • In PdsCustSellableDays the intention is to only enable the active product dimensions for the selected item, and disable all of them if we selected all items or an item group instead. But only product dimensions are to be shown ever. This is achieved by using the following methods:
      • parmDimParmEnabled(InventDimParm) controls which dimensions can be edited
      • parmDimParmVisible(InventDimParm) controls which dimensions are shown
      • parmDimParmVisibleGrid(InventDimParm) controls which dimensions are shown in the grid.
      • parmDimParmLockedRightClick(InventDimParm) controls which dimensions can be selected through the Dimension Display button
      • formSetControls(boolean) actually executes the update of the inventory dimension controls based on the above settings. The first parameter controls whether the form is locked for the duration of the update (preventing unnecessary flicker, especially in cases where controls are being made visible/invisible in the grid).
      • formActiveSetup(InventDimGroupSetup), which is not used here, but is frequent in other forms, should be called when the active record is changed, and resets the enabled fields based on the now selected item dimension group information.
      • dimFieldsActive(InventDimParm) that is also used in the form is actually an inquiry-type method, and does not impact the state of the object in any way. Its purpose is to return a container of active dimension field IDs based on an InventDimParm buffer.
  • Lookups for all the product dimensions are based on the form called InventProductDimensionLookup, which is another example of generic handling of inventory dimensions, and has all the above properties as well.
    • It can show up to 3 tab pages, including the selected product dimension values, all relevant product variants and the on-hand information
    • In the current version of the form, all existing product dimension values are shown, regardless of the product. This is one of the things we need to fix.

 

Changes made and result

OK, so in order to accomplish the 2 tasks we set for ourselves above, we only need to change code in 3 places on the form. Let’s walk through each one in turn.

  • Modify the classDeclaration, and replace the type InventDimCtrl_Frm with InventDimCtrl_Frm_ProductDim. If we take a look at this class (it is only available starting from AX 2012 R3 CU8, so I am also including the code for this class below, for reference), we can see a few methods were overridden:
    • mustEnableField() makes sure that only the active product dimensions based on dimension group setup are enabled. This is used by the formActiveSetup method, and is not as interesting for our example.
    • mustShowGridField() makes sure that all product dimensions are shown in the grid, and only product dimensions. This was controlled by explicitly calling parmDimParmVisibleGrid() before. We’ll remove that code, as you’ll see later.
    • setupShowAllProductDimensions() – this method is important for our example. This method, if it returns true, will ensure only product dimensions are shown on the Dimension Display dialog.
  • Modify the updateDesign method as below
    • Remove the lock/unlock method calls, since this is already going to happen within formSetControls().
    • Initialize the inventDimSetupObject using the right class InventDimCtrl_Frm_ProductDim
    • Remove the variables inventDimParmDefault and inventDimParmDisenabled, and all code related to them. This code is now redundant.
    • Remove the call to dimFieldsActive. As I mentioned above, it does not do anything useful for us.
    • We can also add 1 extra line clearing the inventDim values that do not apply – this is important for when changing the item number where we already have product dimensions selected. Just a bug fix, not really related to this tutorial.
  • Add a new method itemId(), which returns the currently selected item number
    • This is necessary for the product dimension lookups to function properly. The lookup tries to find the item information from the calling form through the data source joined to InventDim as a parent, assuming it has an ItemId field. While that is true in most cases, our form uses a TableGroupAll pattern, so the field is a bit different. By creating an itemId() method on the form, we ensure that the lookup can find the right item number to reference when retrieving product dimension group information.
    • In updateDesign, after initializing the object, invoke parmSkipOnHandLookUp(true), which will ensure that the on-hand tab page is not shown on the lookups. Since this is not necessary for this type of setup form, it’s a good idea, since it will improve the lookup loading time. This is also demonstrating how the lookup form uses the inventDimSetupObject of the calling form to get the expected behavior settings.
    • The lookup will now also show the Combinations tab page, if the selected product has more than 1 product dimension active.

That’s it. With very few changes, we were able to drastically change the look and feel of this form. Here’s how it looks now:

Updated form behavior

 

Download the project

You can download the project with the changes I have made from my OneDrive.

Friday, December 19, 2014

Tutorial: Auto-Complete functionality on form controls


I guess all of you are familiar with the Auto-Complete feature present in Dynamics AX. Whenever you type in a repeated value in a control on AX forms, an automatic suggestion pops up next to the entered characters and the user can choose to accept the suggestion (for example, by tabbing out of the control).
There are methods on the form (specifically, the FormRun class) that provide you with a more tight control over the auto-completion list available to the user, and this blog post will describe the behavior of these methods, as there are a few not obvious things there.

Method signature Method behavior description
getAutoCompleteString(int _elementIndex) Retrieve the auto-complete string saved under the specified index in the auto-completion list of the form.
The indexing is not control-specific, and is not very efficient at keeping the number of values in the list low, so you will see values from multiple controls here.

The method returns a container containing 2 values:
- the auto-completion string value
- the index of this string in the auto-completion list
getAutoCompleteString(int _startIndex, FormControl _control, str _searchStr) Retrieve the auto-complete string for the specified control, finding the first one in the list starting from the specified startIndex + 1.

If _searchStr is also specified, it will find the first matching entry in the list with index > startIndex. This is the closest behavior to what happens when a user types in a certain character in the entry control on the form and the kernel needs to search and populate the auto-complete value for it.

Note: There’s a small bug in this function, where it does not return the full string value for longer texts. A workaround is to use the above “overload” and retrieve the full value by index.
setAutoCompleteString(string _string, anytype _control) The first argument is clear, and that is the auto-completion string to add to the list of suggestions.

The second argument is presented as _control, but can accept either an instance of a FormControl, or an integer value of the list item index to set.

If the _string already exists in the auto-completion list for this control, nothing will happen. If it does not exist, a new item will be added to the list (number of items cannot exceed 300) with the next available index.
setAutoCompleteString(string _string, anytype _index) The auto-completion list item at index _index will be updated in the list with the specified _string value.

This method “overload” basically allows you to override a particular value in the list with a new value.
delAutoCompleteString() Deletes all auto-completion items from the list, regardless of which control they are bound to, if any.
delAutoCompleteString(anytype _index) Deletes the item with the specified index from the auto-completion list.
delAutoCompleteString(anytype _control) Deletes all auto-completion items for the specified control from the list.

When a value in one of the controls on the form is modified, this value is also automatically added to the auto-completion list. With the above methods, however, you can control, if this value should actually stay there, or be immediately removed.
This way you can, for example, restrict the user to only be provided with auto-completion hints from a certain list (similar to IntelliSense).

I created a simple form to demonstrate all the above methods in action.

Tutorial auto-complete capabilities form
Tutorial form to demo auto-completion capabilities

You can download the form from my OneDrive.


Apart from the above methods, there is also a global setting which allows you to control auto-completion list availability for a particular user. This is control on the User options screen, as highlighted in the below image:

Autocomplete in User options
User options form


If this check box is not set, auto-completion suggestions will not be shown to the user when entering data on forms, even though the auto-completion list is still maintained behind the scenes.

Wednesday, December 03, 2014

Tip: Connecting the Warehouse management device portal to a different company or partition in Dynamics AX

As a follow up to my blog post about fixing an annoying error with the warehouse mobile device portal (see original post here), I got a number of people asking the following question:
"How do I install/configure the mobile portal to work in more than one company/partition?"
This is possible, and relatively easy, even though it might not be the most intuitive thing to do. Here's a quick walk-through of allowing work users to access another company account portal.

The Warehouse mobile device portal (WMDP) as of today only supports connecting to a single company account in a single partition. This is driven by the Active directory account used as the identity for the IIS application pool that is used to run the WMDP.

Which means that in order to access another company, we need to:

  • Create another Active directory account
  • Install another instance of the WMDP
    • Use a different port number than the ones already installed
    • Use the above AD user as the identity for the app pool
  • Add a user in AX for the above Active directory account
    • Do it in the partition you want to connect to
    • Set the default company to the one you want to connect to
    • Don't forget to assign the correct security role
    • Hint: You can also set the default user language, which will impact the WMDP site as well
  • Create all the necessary Warehouse management data in the new partition/company. That includes the Display settings, Warehouse workers and mobile device users, warehouses, etc.

Note, that you should avoid having the same AD user (used for WMDP) be part of multiple partitions. Only the first partition (alphabetically) will be connected to, but it becomes confusing for people looking at the data.


Once these steps are complete, you should be able to use the new link (with the new port) to connect to the mobile device portal and log in as a work user from the new company account.

Monday, October 13, 2014

Tutorial: High level overview of entity statuses in the new Warehouse management solution

I’ve seen a number of questions on the community and yammer groups asking about the statuses for Loads, Work, etc, where people were not sure what that means. I dug up this document with a brief description of all the possible statuses for Loads, shipments, Waves and Work in the new solution.
Hope you guys find it helpful, as I did at some point.
Load
  • Open: Load has been created, but no other warehousing processes have been executed on the load. Some or all load lines are not part of a shipment.
  • Posted: Load has been released to warehouse; related load lines have been assigned to shipments. These shipments may or may not be on a wave. If on a wave, the wave has not been executed.
  • Waved: Shipments tied to the load have been assigned to a wave, and the wave was executed. Any work that was created through the waving process has not been started.
  • In Process: Work tied to the load has started being executed, but does not meet the qualifications for an “In Packing” or “Loaded” status (see below).
  • In Packing: Work has been created for the entire quantity of load lines. All work has been put down to the manual pack station.
  • Loaded: Work has been created for the entire quantity of load lines. If not using a packing flow, all work has been put to a final shipping “baydoor” location. If using packing, all containers have been closed (All quantity tied to the load is picked against the appropriate sales/transfer orders).
  • Shipped: Load has been ship confirmed.
  • Received: For inbound loads, product receipt has been run for all quantity tied to the load.
Shipment (similar to load)
  • Open: Shipment has been created, but no other warehousing processes have been executed on the shipment.
  • Waved: Shipment has been assigned to a wave, and the wave has been executed. Any work that was created through the waving process has not been started.
  • In Process: Work tied to the shipment has started being executed, but does not meet the qualifications for an “In Packing” or “Loaded” status (see below).
  • In Packing: Work has been created for the entire quantity of load lines associated with shipment. All work has been put down to the manual pack station.
  • Loaded: Work has been created for the entire quantity of load lines associated with shipment. If not using a packing flow, all work has been put to a “baydoor” location. If using packing, all containers have been closed (All quantity tied to the load is picked against the appropriate sales/transfer orders).
  • Shipped: Shipment has been ship confirmed.
  • Received: For inbound shipments, product receipt has been run for all quantity tied to the shipment.
Wave
  • Created: Wave has been created. The wave may or may not have shipments assigned to it, but it has not yet been executed.
  • Executing: The wave is in the process of being executed. (Useful status for long running waves)
  • Held: The wave has finished executing, but has yet to be released. Any work that was created during the execution process is frozen, preventing it from being started until the wave is released.
  • Released: Wave has been released. Any work tied to the wave is unfrozen and able to be executed.
  • Picked: All work tied to a wave has been completed.
Work (Applies to both work header records and work detail lines)
  • Open: Work or work line has been created, but not started by a worker.
  • In Process: Worker has started work or work line, but not completed either.
  • Pending Review: Specific to cycle count work header only. Occurs when worker counts incorrect quantity or dimensions, but does not have the rights to automatically adjust inventory.
  • Skipped: Applies to work lines only. Status is applied for non-mandatory work lines when 'Skip non-mandatory work' option is used for a selected load/shipment.
  • Closed: Work or work line has been completed.
  • Cancelled: Work or work line has been cancelled.
  • Combined: Applies to work header only. Occurs when executing the “Pick & Pack” RF flow which combines multiple work units into a single one.

Monday, July 14, 2014

Announcement: Warehouse management system implementation guide for Microsoft Dynamics AX 2012 R3 is now available for download

If you have been following my latest posts on the new Warehouse management module in Microsoft Dynamics AX 2012 R3, and are curious to find out more, you should check out the new implementation guide that has been released today.

You can download it through the following link:
http://www.microsoft.com/en-us/download/details.aspx?id=43660

If you have any feedback on the guide itself, or on the information missing from it, feel free to reach out through comments to this post, and I will convey the message appropriately.

Enjoy the read!

Saturday, July 12, 2014

Walkthrough: Cancelling put-away work in Microsoft Dynamics AX 2012 R3

In the new Warehouse management solution shipped with Microsoft Dynamics AX 2012 R3, any movement of inventory in the warehouse would normally have a corresponding piece of work registered together with work lines detailing where the warehouse workers should pick the goods from and where they should put them.

Therefore, it is no surprise, that when you receive a purchase order (or any other inbound order, like a transfer or a return) through the new mobile device portal, work will be created to put away the goods into a storage location (or QA or whatever you set up in your location directives). The closest analogy for those who know the existing WMS II solution that I have is the pallet transports used in conjunction with arrival journals, where goods get physically registered at the inbound dock, and a pallet transport is created to move the pallet to the location found based on the put-away rules selected on the arrival journal line (Check picking/bulk locations). The new solution allows a much better level of control over all the warehouse operations.

What I want to talk about today is the cases where the created work is not satisfactory and needs to be modified / canceled.

There are three scenarios I would like to mention:

  1. The put-away location needs to be changed, because the suggested location is unavailable or another location is simply preferable.
  2. The put-away work needs to be canceled, where a decision about the put-away location will be taken later
  3. The put-away work needs to be canceled, because the receipt was incorrect to start with



1. If the warehouse worker doing the put-away is an experienced user who is allowed to make on the spot decisions about modifying the suggested flow of inventory, he can override the put location, storing the goods away into a different location at the warehouse.

This is controlled by a policy on the setup of warehouse workers, accessible through Warehouse management \ Setup \ Work users \ Worker, as shown in the below screenshot:

Work user policies
Allow work user to override put location when executing work

2. Another way to achieve this would be to cancel the pending put-away work, ensuring that workers do not see it on their mobile devices as something they should execute now, and creating a manual movement to a location of choice when the decision where to move the goods is made. This would be a decision done by a receiving clerk / warehouse manager. 
It could also be due to some extra paperwork or inspection being done on the items, where it's yet unclear if the system-selected put-away location is OK. (If it is, the warehouse manager could simply block the work until a decision is made, which would prevent workers from executing on it)

In order to cancel the work, simply press the "Cancel work" button on the Work details form (or corresponding list page). See a step-by-step walk-through below.


3. Now, sometimes, due to input errors or other factors, you would want to not only cancel work, but also make sure the goods are not physically at the warehouse either, reverting the entire receipt as if it never happened (you'll still have a trace of it happening). This could, for example, be useful if the receiving clerk was logged in to a different warehouse and accidentally received a purchase order to that warehouse instead of the one the user was actually at (Note: Not possible in RTM, need a corresponding hotfix installed).

This additional step of unregistering the items is controlled by a policy on the Warehouse management parameters, called "Unregister receipt when canceling work".

Warehouse management parameters
Warehouse policy - Unregister receipt when canceling work


Here is a step-by-step description of the cancel workflow:
  • Create a new purchase order for a WHS-enabled item to a WHS-enabled warehouse
Purchase order details
Purchase order with one line for a WHS-enabled item to a WHS-enabled warehouse
  • Using the mobile device portal, register the receipt of the above purchase order (Hint: use a mobile device menu item with Mode = Work and Work creation process = Purchase order item receiving)
PO receipt
Purchase order receipt on Mobile Device Portal

  • View the inventory transactions for the above purchase order, and confirm that they are registered at the default receiving location at the selected warehouse (Note: It is the warehouse the user was logged in to when doing the PO receipt from the mobile device)
Inventory transactions
Purchase order inventory transaction with Receipt status = Registered

  • Open the created put-away work (Hint: You can navigate directly to the new piece of work from the purchase order details form, by clicking on Work details button in the Lines section), and click on Cancel work.
Work details
Canceling put-away work

  • Confirm that Work status of the work header and lines has changed to Canceled, and (depending on the above warehouse management policy) the purchase order line inventory transaction is back in Ordered receipt status. 

Note: This policy is currently implemented only for Purchase orders and Transfer order receipts. It will not come into play when registering the receipt of a return order or any other inbound order types.


I would also be interested in hearing your scenarios, which require canceling put-away work, and the reasons behind them. So if you use this functionality for reasons other than described above, please leave a comment below.

Thanks

Friday, May 09, 2014

Walkthrough: Fixing error "Incorrect Mobile device display settings..." on the mobile device when trying to sign in

All the people who have tried the new Warehouse management mobile solution by now have probably hit the issue below and were confused about the error message displayed, as well as how to fix this.

The scenario is simple:

1. Install and Configure the Warehouse Mobile Device Portal through setup.exe.
As part of this step, you will need to specify a domain account to use as the identity of the IIS application pool that is used to run the Warehouse Mobile Device Portal (WMDP in short).

Warehouse Mobile Device Portal Installation Wizard

2. Completing the installation process will create a site in IIS. You can access this site, and it will open the WMDP home screen. If you now click on Log on to the mobile device, you will get the below error, if the domain account from the IIS app pool is not added as a user in Dynamics AX, or if he does not have sufficient privileges to run the mobile device portal.

WMDP error - insufficient privileges to connect to AX

3. After adding the user to AX and assigning the appropriate roles to him, you can try logging on to the mobile device again. Now, you might get a different error, like below

WMDP error - display settings are not configured

If you read the error message, you can see it complains about the mobile device display settings not being configured. Well, let's check them out, under Warehouse management > Setup > Mobile device > Work user mobile device display settings
As you can see on the below screenshot, I have them defined, and the setup is valid. Hmm, what is the above error about then?

Work user mobile device display settings

Root cause:
The problem is actually with the default company set for the above AX user. By default the portal tries to connect to the company set as the default for that user, and thus cannot find the display settings, since they are created per company and don't exist in DAT (most probably).


4. After assigning a valid default company to the AX user, the domain account of which is running the IIS app pool for WMDP, we can try logging on to the mobile device portal again. Now we can see that we reach the Sign in screen, which means all is good in the world. :)

Warehouse Mobile Device Portal Sign In page

Hope that helps avoid initial confusion when trying to use the mobile device portal!

Walkthrough: After setting up a work-related Mobile Device menu item the user is constantly logged off when trying to use it on the device

Hey guys

As some of you might know, I was part of the team that released the new Warehouse and Transportation solution as part of Microsoft Dynamics AX 2012 R3.

As with any first version of the product (and this is a huge solution), there are certain issues that we simply did not have time to address. Some of them are however pretty hard to figure out the root cause for, unless you spend time debugging or know where to look to start with.

When setting up Mobile Device menu items to use at the warehouse, you have a couple of possibilities for what type of menu item it is going to be. Specifically, it can be a non-work related activity, a work-related activity, which results in creation of new work, or processing of existing work.

I won't go into the full description of how to set this up - you can easily find this information on technet, MSDN, etc.

Here's the short version of the flow, and the problem you might experience.

  1. Navigate to Warehouse management > Setup > Mobile Devices > Mobile device menu items
  2. Create a new menu item, and fill in the fields. Select Mode = Work, Use Existing Work = false.
  3. Select Work creation process = Load item receiving
  4. Save the record. It should look like below
  5. Add the created menu item to one of the available mobile device menus.
  6. Log in to the mobile device with any available work user and navigate to the menu item created above.
Mobile device menu item
The created Mobile device menu item

Possible result of executing the above steps:
Sometimes, without any explanation, the user is consistently logged out of the mobile device, when trying to use the newly created menu item.

Root cause:
The problem can be that when creating the menu item, you accidentally selected an Activity code, changing its value from None to the next value on the list, which is Log off. This can happen quite easily, especially if you normally use the keyboard and not the mouse to click around. 
Now, even though you later changed the Mode to Work, the system still remembers the selection in the Activity code, and will apply it when using the menu item, resulting in a log off.

That's quite annoying, but also very easy to fix, just flip Mode to Indirect, revert the Activity code value back to None, and flip the Mode back to Work. All your settings for work creation setup should stay intact. 


To finish off, I just want to encourage all of you to install Dynamics AX R3 and try out the new modules, and send us feedback through Connect, Yammer, or comments on the SCM blog or here.

Thanks


Saturday, December 14, 2013

Tool: Update: User preferred startup menu for AX 2012


I have over the last year received a couple mails and comments from people, asking to publish an update for the below tool for AX 2012

http://kashperuk.blogspot.dk/2010/04/tool-user-preferred-startup-menu-for.html

There aren't really any serious changes to it as such, just some minor things.
Again, note, that there are a few changes to some of the existing "high profile" AOT elements, so please read through the description of changes in the above post.

Download updated xpo

Wednesday, August 29, 2012

Inside Microsoft Dynamics AX 2012 is available for Pre-Order


With the release of AX 2012 the market was in need of an updated book on the development aspects in X++/.NET for the purposes of extending the AX application functionality.

As some of you might know, I translated 2 of the MS Press books on AX development for the previous versions to Russian.

This time around, I was lucky enough to participate in the creation of the English version as well.


Inside Dynamics AX 2012 book cover
The book has been significantly updated to account for the numerous changes in the latest AX release, so I am sure many of you will enjoy the read.

The book is not out yet, but you can pre-order it at Amazon by using the link below

Pre-order "Inside Microsoft Dynamics AX 2012" now


Enjoy!

Wednesday, November 09, 2011

Tutorial: Debugging AX while still using restricted roles (non-admin)

Saw this on our internal forum today, and thought it's a nice thing to share with all of you.


1.       Close All AX instances

2.       Open AX Development Environment (ax32.exe -development)

3.       Open AX Application (ax32.exe)

4.       Add Role that you would like to test to your UserId

a.       System Administration > Common > Users

b.      Find yourself and double click to get to the detail window

c.       Assign role that you want to test

5.       Close AX Application

6.       Set break points in AX Development Environment

7.       Create a job and add this line

             SecurityUtil::sysAdminMode(false);
 
8.       From the AX Development Environment “Ctrl W” to open the application

9.       You are now in a reduced permission user and have the ability to debug. J
 

To get your environment back to full admin, re-execute the job in step 7 with a true.


Note: This will not work for EP, Services, direct BC.NET and cases using runas(), as the SecurityUtil::sysAdminMode is limited to the current session.


Ed Budrys from our Security team deserves the credit for the above.

Let me know if you found this to be useful.
Thanks

Friday, October 28, 2011

Tutorial: AX 2012 - Invalid field access or Accessing unretrieved fields

Read the post all the way until the end - there's an ask for you guys there!

As many of you have already seen in the new AX 2012 release, there are a lot more tables present in the application, because we went through an exercise of normalizing the data model.
Another feature that was added at the same time was the Table Inheritance, allowing to sub-class tables and add additional fields reusing some of the behaviors of the base table.

All of it is great! The only problem with it is that it comes at a price - we now need to retrieve a lot more data and do a lot more joins between tables. So we tried to mitigate that by using field lists where possible and adding AdHoc query support, which basically eliminates unneccessary joins between tables from the hierarchy, if fields from these tables are not selected.

We have also implemented a number of things that allow us to clearly see if the field was selected in the user interface, the APIs needed for doing the same, as well as special handling for invalid field access.

This tutorial contains a form, which showcases the different aspects of data access in cases described above.
You can download the project with the tutorial from my SkyDrive.

On the first tab, we have the standard "On hand" view, which in the data model is a join between InventSum and InventDim, with group by clauses on selected fields, in this case, ItemId from InventSum and InventLocationId from InventDim, and aggregation on the AvailPhysical column.
As you can see from the screenshot below, the rest of the InventDim fields are shown as Unretrieved. So, naturally, accessing one of them from code, for example, should not be a legal operation.
To verify that statement, there are 2 buttons on the form, the Incorrect and the Correct was of accessing the field. Clicking on the first one simply tries to read the value out of the InventSiteId field, while the second one uses the API method TableBuffer.isFieldDataRetrieved() to first verify if the field can actually be accessed.

Note, that in the below example, both buttons will work, as in, there won't be any errors shown to the user. When accessing the field, even though it is not retrieved to the client, the value will be treated as the default value for that type, that is, an empty string.

In order to verify that we do not access fields in an invalid way like above, we have introduced a parameter, that will throw an exception if a field that was not retrieved is being accessed.

In order to enable this validation, you need to update the below shown parameter in the Server configuration form (Located under System administration \ Setup \ System). After changing the value (note, that it is per AOS) you need to restart the AOS for the changes to take effect.


Now, if you try to use the first button (under Incorrect) from above, you will get a stack trace, notifying you that the specified field was not retrieved.



We suggest that when testing your modifications in the application, you always have that flag enabled, so as to avoid unpleasant and hard-to-find bugs later on in the production environment.


On the second tab of the Tutorial form, the same type of information is presented, only this time the output is actually based on a new table inheritance structure I created.


The base table, GenericBall, contains 2 characteristics of any ball. SoccerBall is extending it and adding an additional characteristic (for the sake of the example, let's assume Brand is only relevant to soccer balls). This is basically a very simple table inheritance structure.

In the form, however, I am only selecting to view the Brand field from SoccerBall, not selecting the other 2 fields from the base table. As expected, they show up as Unretrieved in the user interface.
However, there is one difference in how Scsc tables are handled - and that is, they will always throw an exception when you try to access one of the unretrieved fields.
The two buttons above the grid demonstrate that. Try it out, enabling/disabling the server configuration parameter shown above.


That's pretty much all there's to it. Let me know if you have any questions.

Now, I have one thing to ask you all too.
We in the AX Test team have done our best to find invalid field access problems before the release, but if you find one using the approach above, please log it either through the standard Microsoft channels (partner/ MsConnect/ etc.), or as a comment directly under this blog post.

Thank you!

Monday, October 24, 2011

Tutorial: AX2012 - A new way of accessing the QueryBuildDataSource for a particular FormDataSource

When playing with some X++ code, I found an interesting addition that happened in AX 2012 related to form development.

There are 2 new methods that were added to the FormDataSource class, which allow you to very easily and error-free access the underlying QueryBuildDataSource, whether that is for the initial form query or for the queryRun that also contains user filters and sorting.

So, for example, instead of writing:

this.query().dataSourceTable(tableNum(InventTableModule), 2);
this.queryRun().query().dataSourceName(identifierStr(Purch));
....

you can use the 2 new methods:

this.queryBuildDataSource();
this.queryRunQueryBuildDataSource();


It might seem as a very minor improvement, but in reality it greatly simplifies maintenance of code on forms, when new datasources are added or existing ones removed/renamed.

That's all for today.

Thursday, July 07, 2011

Help content for Microsoft Dynamics AX 2012 is now available on TechNet

As you might have heard, AX 2012 has RTM'ed recently.
Now, the question you might ask is - OK, I have read the What's new in AX 2012, but that's not enough. The changes are too vast and I need more detailed information about them.

Well, worry no more :)

The information about AX 2012 is now available on TechNet, with a lot of new content still being added each day. And, finally, it's actually interesting to read. We now have various graphs, diagrams and tables that should help you understand each feature area a bit better.

Hint: The description of the functional modules of the application is under section 5. Use Microsoft Dynamics AX.

Enjoy!

Microsoft Dynamics AX 2012 Technical Library
http://technet.microsoft.com/en-us/library/gg852966.aspx

Saturday, May 07, 2011

Tutorial: Table Relation properties in AX 2012

As many of you already know, Microsoft has put in a lot of effort into normalizing the tables in AX 2012 and consolidating all the data modeling tools in one place - the table itself. As part of this effort, a number of new properties have been introduced on Tables, and in this post I would like to cover some of them, namely the properties on Table Relations.

The new properties you will find on a Table Relation in AX 2012 are:
  • Cardinality
  • RelatedTableCardinality
  • RelationshipType
  • Role
  • RelatedTableRole
  • UseDefaultRoleNames
  • CreateNavigationPropertyMethods
  • NavigationPropertyMethodNameOverride

Hua Chu from the AX team has written a Guideline document, explaining how these properties should be set for Relations you add to Tables in AX. Note that in AX 2012 most of the above information is not actually used at runtime. This is something that will happen in future releases.
I have modified the document so that it contains the information relevant for partners and customers extending the standard application and have uploaded it to my OneDrive.

The document requires certain knowledge of Entity Relationship Modeling (ERM) and UML notation.

Disclaimer:
This document is intended as a guideline only, and should not be used as a Step-by-Step instruction.
Changes to any of the described functionality might still happen before AX 2012 RTM.


Your feedback and questions are, as always, welcome.

Monday, April 11, 2011

Microsoft Dynamics AX 2012 Beta now available for download - please share your feedback

As some might have noticed, I was quiet for quite some time now. I won't go into much detail as to why. What I want to say is that I along with a number of dedicated people have been hard at work on the release of a solution for Process Manufacturing and Distribution industry, which is also available in Beta through the below links.

Those of you working in this industry, I would be grateful for your feedback on our work so far, as well as any bug reports or design change requests for the RTM version or future releases.
Any other feedback, especially on the development tools and environment, is also welcome, of course.


Virtual Machine: 

https://mbs.microsoft.com/customersource/downloads/servicepacks/AX2012DemoToolsMaterials


Installable bits (ISO & IS IExpress pkgs):

https://mbs.microsoft.com/partnersource/support/selfsupport/productreleases/AX2012Beta

MSDN Dev Center:



TechNet Library: