Monday, September 11, 2017

Find product attributes and values for an item in AX 2012 via X++

In the event you need to see what the product attributes are while debugging some stuff, run the below script.

This is for AX 2012 but probably works for D365, I'm not sure. Give it a shot.

It literally takes an item id and gives you the attributes and values in those attributes. Pretty straight forward

static void DAXGetProductAttributes(Args _args)
{
    EcoResProductAttributeValue ecoResProductAttributeValue;
    EcoResAttribute             ecoResAttribute;
    EcoResValue                 ecoResValue;
    ItemId                      itemId      = 'A10021'; // This is a sample Item Id
    InventTable                 inventTable = InventTable::find(itemId);

    while select RecId from ecoResProductAttributeValue
         where ecoResProductAttributeValue.Product   == inventTable.Product
         join Name from ecoResAttribute
             where ecoResAttribute.RecId                 == ecoResProductAttributeValue.Attribute
             join ecoResValue
               where ecoResValue.RecId                     == ecoResProductAttributeValue.Value
    {
        info(strFmt("%1 - %2 - %3", InventTable.ItemId, ecoResAttribute.Name, ecoResValue.value()));
    }
}

Saturday, June 3, 2017

MPOS Error: Creating device token failed

A little nugget of information:
In  Microsoft Dynamics AX 2012 R3 MPOS, if you receive an 'Creating device token failed' error when attempting to activate the POS or while doing transactions, you'll be halted from proceeding with what you are doing. The error will also say "- The value of Content-Type on server response is not supported."

A common culprit to this is that there is another terminal being used with that exact same Device profile.

The MPOS application can only be installed and activated on a per user basis, not for all users logging into a machine. So Sally can't log into the PC with her credentials and then the MPOS with her information while Tommy doing the same thing only under his PC AD credentials.

As a best practice, the users should all log into a generic account for that store/terminal where the MPOS is activated and then log into the MPOS under their own IDs.

Check the different users and see who is logged into what from a PC (Not POS) perspective as well as anyone in the backoffice or other stores.

Here is a scenario in which this could occur:
Someone may have accidently registered terminal 2 at store 52 as Terminal 2 at store 25, which would cause the store25 terminal 2 to get this error. Also, the person activating the device in the self-service model could've installed/activated the device under THEIR AD account, not the proper stores AD account.

Hopefully this helps!

Friday, May 19, 2017

AX POS Permission Groups and Leading Zeros - Solved!

In my previous blog post, AX Modern POS Retail Channel Reports missing and setup, I discussed an issue I hit where I would go into the Retail Channel Report Configuration form and setup permission groups. These groups would immediately not save the values in the form. The form field is a multi-select field so it won't save invalid values.

The values were invalid as the leading zeros in the POS Permission group were being dropped by the code in Figure 2 below. Changing these names to something other than a value with a leading zero fixed the issue (Figure 1).



Figure 1 - Need to start the POS Permission Group name with NOT a zero

Figure 2 - AX will drop leading zeros

Tuesday, May 9, 2017

AX Modern POS Retail Channel Reports missing and setup

When in the Dynamics AX Modern POS, you have the capabilities to do reporting based on the local store DB. There are 13 canned reports that come out of the box, but a user can add additional as needed or modify the base reports.

Some may notice when entering the POS Reports screen that there may not be any reports in this screen out of the box. Its just blank. Or they get a POS Permissions error. This is because the Retail POS reports are driven off of POS Permissions and may not have any assigned. POS Permission groups need to be added and pushed down to the store for them to be visible (via the 1110 job in Figure 2).

I had an issue where the Retail Channel Reports Configuration would never actually populate the ‘Permission Group’ field after setting it (Figure 1). Setting it would only create a record in the table in the backend with a 0 RecID field value in the POSPermissions field I just tried to set. 

Initially there were no records in the ‘RetailReportPermissionGroup’ field. And the data was never in the POS store tables (hence no reports visible). Only by adding a value to that field would it create a record in this table. And the POS Permission group would overwrite to zero. So it didn't actually work.

My fix to this was going into the AOT and manually set the fields to the POS Permission Groups (Figure 3). If you go back in the ‘Retail Channel Reports Configuration’ form after all the values are set, the POS Permission value in the backend would override the RecID to 0 again.

UPDATE: I solved the issue of the POS Permission groups disappearing in my post here: http://daxdude.blogspot.com/2017/05/ax-pos-permission-groups-and-leading.html

HELPFUL HINT 1
I would recommend that you copy an existing report and modify it till you are comfortable with how the reports run before creating one from scratch. 

HELPFUL HINT 2
As a recommendation, only make the report reports action button visible to people who can actually access the reports. Otherwise it looks like a system bug. 



Figure 1 - The retail channel reports with the missing Permission Group

Figure 2 - Run the 1110 job to push the POS retail reports to the stores

Figure 3 - The 'RetailReportPermissionGroup' table

Sunday, April 2, 2017

Modern POS Navigation Hierarchy Setup

The Modern POS is great. I really like it. But there are a lot of new setups in relation to the previous 'Enterprise POS'. One of these features is the POS navigation hierarchy.

There is only one 'Retail Product Hierarchy' in AX but there can be multiple 'Supplemental Navigation Hierarchy' records you can configure. These supplemental hierarchies can be attached to your store POS.

If you wish to do this, you can do it through the 'Channel categories and product attributes' form. The user should select their appropriate channel and change the 'Category hierarchy' field to the hierarchy of their choice.

Some times you will make this change and switch over to the POS and not see the hierarchy immediately. You will need to make sure to run the appropriate distribution job to push the data to the store, then make sure the store refreshes this hierarchy. If its not done refreshing, it may show up blank initially. Waiting will usually resolve this issue. I am not aware of a way to speed this process up at the moment.

Figure 1 - The Modern POS navigation setup

Figure 2 - The setup for the POS hierarchy

Wednesday, March 15, 2017

Dynamics 365 for Operations - Determine table/field/datasource name on form and query of data

Things have changed since AX 2012 R3 in regards to navigation. The days of navigating to the AOT from the front end are over. The fluid connection before front and back has been separated, for good reason. But that has created some challenges in the new navigation.

If you see a field in Dynamics 365 for Operations and need to navigate out to it, you can do the process in Figure 1 below. You right click on the field of interest, hover over 'Form information' option, and then click the 'Form Name: ....' option.

You'll see the 'Form name' window appear which contains a wealth of information. It shoudl be fairly similar but you will notice a few additions. In Figure 2 below, you'll see:

  • Control Information
    • Datasource = the name of the datasource (not the table name but generally is. The table name 'should' be fairly similar. You'll want to look for the query statement to confirm)
    • Data field = the name of the datasource field (generally table field name)
  • Form Information
    • Form name = the form that the menu item is tied to
    • Menu item name = the name of the menu item as it is in the AOT
    • Menu item display = the type of the menu item (display/output/action)
  • Query Statement
    • The query for the datasource. This is nice to see on the front end. No need to dig for it in the back end with the QueryBuildDataSource in code. 

Hope this helps!

Figure 1 - Navigation to the form information 

Figure 2 - The information on the form information

Monday, March 6, 2017

Dynamics 365 for Operations Error - 'The user is not associated with a Worker. You need to associate the user with a Worker and then try again'

Hello Blogger, my old friend. 
I've come to post to you again. 
Because of issues softly creeping
Left its chaos while I was sleeping
And the anxiety that was planted in my brain
Still remains
Within the sound of typing...

The issue
I was attempting to create a new catalog in Dynamics 365 for Operations and got the error message 'The user is not associated with a Worker. You need to associate the user with a Worker and then try again' (Figure 1). I had associated my user with a worker identity which is required for the POS activation process but wasn't sure what this was.

The fix
You need to associate a 'person' to your user (Figure 2). So navigate to System Administrator > Users > [your user]. You'll probably notice that the Person field is missing. Enter into your user (as I couldn't edit this from the grid), click 'Edit' in the toolbar. You'll be able to click the drop down of that field and see the users in the system (Figure 3)

I'd recommend that you make this the same user as the one with the associated identity you use in retail.

Hope this helps!!

Figure 1 - The error 'User is not associated...' 

Figure 2 - The missing worker association

Figure 3 - Select the worker