Pages

Tuesday, November 22, 2016

Dynamics 365 for Operations (AX7) leverages Facebook libraries

So a little known thing about Microsoft Dynamics 365 for Operations (AX7) is that the user interface appears to be built on Facebook's React JavaScript libraries, specifically React with Addons.

Hearing Facebook and D365 in the same sentence initially makes me wince a little, but it makes perfect sense. Facebook is in the business of user interface on the web, so why would Microsoft reinvent the wheel for user interface when the engineers at Facebook are leading the way and devoting more resources towards it?

You can see the React JS files in various locations, such as C:\AOSService\webroot\Scripts\ext\react*.js on a demo VM.



If you've tried to create/debug a D3fo custom control using Chrome/FF developer tools and stepped into the JavaScript, you'll eventually see it in the min versions of the React libraries.

As of writing this, the current version embedded in the Nov 1611 VM is 15.1.0 while the available is v15.3.2.

So if you're experiencing bugs with some controls, there may be a fix on the horizon.

Dynamics 365 for Operations (AX7) leverages Facebook libraries

So a little known think about Microsoft Dynamics 365 for Operations (AX7) is that the user interface appears to be built on Facebook's React JavaScript libraries, specifically React with Addons.

Hearing Facebook and D365 in the same sentence initially makes me wince a little, but it makes perfect sense. Facebook is in the business of user interface on the web, so why would Microsoft reinvent the wheel for user interface when the engineers at Facebook are leading the way and devoting more resources towards it?

You can see the React JS files in various locations, such as C:\AOSService\webroot\Scripts\ext\react*.js on a demo VM.



If you've tried to create/debug a D3fo custom control using Chrome/FF developer tools and stepped into the JavaScript, you'll eventually see it in the min versions of the React libraries.

As of writing this, the current version embedded in the Nov 1611 VM is 15.1.0 while the available is v15.3.2.

So if you're experiencing bugs with some controls, there may be a fix on the horizon.

Wednesday, May 4, 2016

The better way to detect when multiple records are selected

There are some instances when you want to know when multiple records are marked on a form. An example would be if you wanted a button to be enabled only when more than 1 record was selected.

You can make a button disabled when more than 1 record is selected, but not the other way around.

As far as I can tell, the way the grid functions is it stores an Array object of the cursor positions of the marked records. Below are the two ways I've seen to solve this problem. Method #2 is more common, but Method #1 seems more efficient to me as you're only interacting with the Array and not traversing the datasource's table buffer.


    FormDataSource  fds = salesTable.dataSource();

    // Method 1
    // The grid stores an array of marked records, and this
    // will return only the index, which is all that is needed
    if (fds.recordsMarked().lastIndex() > 1)
        info("Multiple records selected");
    else
        info("1 or 0 records selected");
    
    // Method 2
    // This will traverse the datasources buffer
    fds.getFirst(true);    
    if (fds.getNext())
        info("Multiple records selected");
    else
        info("1 or 0 records selected");

    // Enabling/Disabling button in one line
    myButton.enabled(SalesTable_ds.recordsMarked().lastIndex() > 1);

And how to enable/disable a button in one line:

    // Enabling/Disabling button in one line
    myButton.enabled(SalesTable_ds.recordsMarked().lastIndex() > 1);