Setup and Enable in Dynamics 365 for Operations

By - June 16, 2017

A behind the scenes feature in Microsoft Dynamics 365 for Operations (MsDyn365) is the setup and enabling for existing and extension functionality. Providing setup pages for the editing of base configuration tables allows a manager or system administrator the ability to change the options that are available for the end user. This article explores the queries, forms, menu items, and security objects that are needed to update the configuration of MsDyn365.

In this case, we will create new possibilities for a familiar tool, the Magic 8 Ball®. The Magic 8 Ball (made by Mattel®) is a mysterious device that provides solutions to all of life’s questions with a simple shake of the ball. Beneath the murky blue netherworld, there are many more choices than expected. Our example builds upon previous articles were we covered database manipulation, X++ control statements, user interface, and security. This expands upon those ideas and completes them with a fully configurable Magic 8 Ball of your own design.

The Query

First, we will need to query the data from the CrazyLuckyTable.  We can then use this query as a data source for our form.

Query Creation

  1. Right-click the project and select Add > New Item.
  2. Select Data Model > Query.
  3. Enter CrazyLuckyTable for the name and click Add.
  4. From the Solution Explorer, drag the CrazyLuckyTable table to the Data Sources of the query.
  5. Select the CrazyLuckyTable data source and set the Dynamics Fields property to Yes.
  6. Save all and click Build.
  7. Ensure that there are no errors. If you have an error, resolve and rebuild.

The User Interface Design

For our process, we will need a setup form that allows us to alter the contents of the CrazyLuckyTable, the one that holds all of the top-secret results for the Magic 8 Ball. For our user interface, we will need to create a simple list page for the user interaction. In addition, it displays the results each time for review.

Create the Form and Apply a Pattern

  1. Right-click the project and select Add > New Item.
  2. Select User Interface > Form.
  3. Enter CrazyLuckyTable for the name and click Add.
  4. From the Solution Explorer, drag the CrazyLuckyTable query to the Data Sources of the form.
  5. Click Design in the right-hand frame of the Form
  6. Right-click Design and select Apply pattern > Simple List. This will list the missing components needed for your form pattern below.   
  7. Right-click Design and select New > Action Pane.
  8. Right-click Design and select New > Group.
  9. Right-click Design and select New > Grid.
  10. Right-click FormGroupControl1 (Group) | Pattern <select> and select Apply pattern > Custom and Quick Filters.    
  11. Right-click FormGroupControl1 (Group) | Pattern: Custom and Quick Filters and select New > QuickFilter.
  12. Drag the Integer and Name fields from the CrazyLuckyTable data source (left side) to the FormGridControl1(Grid) (right side), as shown below.   
  13. Save all and click Build.
  14. Ensure that there are no errors. If you have an error resolve and rebuild.

Create the menu item

  1. Right-click the project and select Add > New Item.
  2. Select User Interface > Display Menu Item.
  3. Enter CrazyLuckyTable for the name and click Add.
  4. Right-click the CrazyLuckyTable menu item and select Properties.
  5. Select CrazyLuckyTable in the Object
  6. Type Crazy Lucky Results Configuration Table in the Label
  7. Save all and click Build.
  8. Ensure that there are no errors. If you have an error, resolve and rebuild.

Add the menu item

  1. Right-click Extension and select Open.
  2. Expand the Setup
  3. Drag the CrazyLuckyTable display menu item to the Setup node.  
  4. Save all and click Build.
  5. Ensure that there are no errors. If you have an error resolve and rebuild.

The Security

Next, we will need to create two privileges: one to run the Magic 8 Ball and the other to enable the configuration of the base table.

Privilege Creation

  1. Right-click the project and select Add > New Item.
  2. Select Security > Security Privilege.
  3. Enter CrazyLuckyTableEnable for the name and click Add.
  4. Right-click the project and select Add > New Item.
  5. Select Security > Security Privilege.
  6. Enter EightBallEnable for the name and click Add.
  7. Save all and click Build.
  8. Ensure that there are no errors. If you have an error resolve and rebuild.

The Configuration

Now, we will need to attach the menu items to the new privileges and add the privileges to the roles.

Attach Menu Items

  1. In the Solution Explorer, expand the Display Menu items and Action Menu items if they are not already visible.
  2. Drag the EightBall menu item from Action menu items to the entry points for EightBallEnable.
  3. Select the new created EightBall entry point.
  4. Configure by setting the access level to Delete.
  5. Select the CrazyLuckTableEnable privilege and click Open. (If it is already open in the middle pane, select it.)
  6. Drag the CrazyLuckyTable menu item from Display menu items to the entry points for CrazyLuckyTableEnable.
  7. Configure by setting the access level to
  8. Save all and click Build.
  9. Ensure that there are no errors. If you have an error, resolve and rebuild.

Extend Role

  1. In the Solution Explorer, right-click the new Extension and select Open.
  2. Drag the CrazyLuckyTableEnable privilege to the privileges ofExtension in the middle pane.
  3. Drag the EightBallEnable privilege to the privileges of Extension in the middle pane. 
  4. Save all and click Build.
  5. Ensure that there are no errors. If you have an error, resolve and rebuild.

Review the Results

Now the real fun begins: you can now test your ability to run the Magic 8 Ball in the user interface and be able to change options.  If you are unfamiliar with the process, follow the steps below.

Assigning the Role

  1. Open Dynamics 365 for Operations as an Administrator.
  2. Click Show navigation pane.
  3. Open System Administrator > Users > Users.
  4. Select the user for testing.

Note: This must be an AAD user from your domain that you know the password for.

  1. Once in the user, unassign all roles except Employee and System User.
  2. In the action pane, click Assign Roles > Select Fleet management branch manager.
  3. Click OK.
  4. Log out of Dynamics 365 for Operations.

Testing the Interface

  1. Open Dynamics 365 for Operations as the assigned user.
  2. Open the Fleet management
  3. Click Crazy Lucky Result Decision Maker under Rentals.
  4. The following are the results for the FMManager. Notice the ability for edit and delete, plus the capability to run the Magic 8 Ball. 
  5. Close the form.
  6. Open Crazy Lucky Results Configuration Table under Setup.

The following are the results for the FMManager. Notice the ability to edit and delete the CrazyLuckyTable, creating your very own customizable Magic 8 Ball.  

Conclusion

This article explored the key aspects of queries, forms, privileges, menu items, menus, and security roles in MsDyn365 for the Magic 8 Ball. In this process you created the interactive model by which a person can now not only run the Magic 8 Ball, they can control the results set.  Because the Magic 8 Ball was designed in our earlier blog article on X++ Control statements to simply select the right answer from a random number that is generated your new answers will work. One item to note, is that you cannot have any more than 20 items in your selection list.  Of course, there is not a regular icosahedron behind the scenes, but we can set the maxVariable to 20. If you were to accept user input or to find the number of objects in the answer table, this would be a challenge beyond this exercise where you can attempt to improve your customization. Enjoy the Magic 8 Ball, but keep in mind that it is not recommended for production or for those 100+ years and older!

For more information, I would recommend that you attend our Dynamics AX or Dynamics 365 training in person or on-demand online to learn more. Plus keep an eye out for more articles that dive in to the technical aspects of using X++ code.  Visit academy.rsmus.com for more information and training materials that will cover this and hundreds of other topics for AX2012 and MsDyn365.

You can contact our Microsoft Dynamics ERP experts or call us at 855-437-7202

by Shaun McMikle for RSM

 

Receive Posts by Email

Subscribe and receive notifications of new posts by email.