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
- Right-click the project and select Add > New Item.
- Select Data Model > Query.
- Enter CrazyLuckyTable for the name and click Add.
- From the Solution Explorer, drag the CrazyLuckyTable table to the Data Sources of the query.
- Select the CrazyLuckyTable data source and set the Dynamics Fields property to Yes.
- Save all and click Build.
- 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
- Right-click the project and select Add > New Item.
- Select User Interface > Form.
- Enter CrazyLuckyTable for the name and click Add.
- From the Solution Explorer, drag the CrazyLuckyTable query to the Data Sources of the form.
- Click Design in the right-hand frame of the Form
- Right-click Design and select Apply pattern > Simple List. This will list the missing components needed for your form pattern below.
- Right-click Design and select New > Action Pane.
- Right-click Design and select New > Group.
- Right-click Design and select New > Grid.
- Right-click FormGroupControl1 (Group) | Pattern <select> and select Apply pattern > Custom and Quick Filters.
- Right-click FormGroupControl1 (Group) | Pattern: Custom and Quick Filters and select New > QuickFilter.
- Drag the Integer and Name fields from the CrazyLuckyTable data source (left side) to the FormGridControl1(Grid) (right side), as shown below.
- Save all and click Build.
- Ensure that there are no errors. If you have an error resolve and rebuild.
Create the menu item
- Right-click the project and select Add > New Item.
- Select User Interface > Display Menu Item.
- Enter CrazyLuckyTable for the name and click Add.
- Right-click the CrazyLuckyTable menu item and select Properties.
- Select CrazyLuckyTable in the Object
- Type Crazy Lucky Results Configuration Table in the Label
- Save all and click Build.
- Ensure that there are no errors. If you have an error, resolve and rebuild.
Add the menu item
- Right-click Extension and select Open.
- Expand the Setup
- Drag the CrazyLuckyTable display menu item to the Setup node.
- Save all and click Build.
- Ensure that there are no errors. If you have an error resolve and rebuild.
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
- Right-click the project and select Add > New Item.
- Select Security > Security Privilege.
- Enter CrazyLuckyTableEnable for the name and click Add.
- Right-click the project and select Add > New Item.
- Select Security > Security Privilege.
- Enter EightBallEnable for the name and click Add.
- Save all and click Build.
- Ensure that there are no errors. If you have an error resolve and rebuild.
Now, we will need to attach the menu items to the new privileges and add the privileges to the roles.
Attach Menu Items
- In the Solution Explorer, expand the Display Menu items and Action Menu items if they are not already visible.
- Drag the EightBall menu item from Action menu items to the entry points for EightBallEnable.
- Select the new created EightBall entry point.
- Configure by setting the access level to Delete.
- Select the CrazyLuckTableEnable privilege and click Open. (If it is already open in the middle pane, select it.)
- Drag the CrazyLuckyTable menu item from Display menu items to the entry points for CrazyLuckyTableEnable.
- Configure by setting the access level to
- Save all and click Build.
- Ensure that there are no errors. If you have an error, resolve and rebuild.
Extend Role
- In the Solution Explorer, right-click the new Extension and select Open.
- Drag the CrazyLuckyTableEnable privilege to the privileges ofExtension in the middle pane.
- Drag the EightBallEnable privilege to the privileges of Extension in the middle pane.
- Save all and click Build.
- 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
- Open Dynamics 365 for Operations as an Administrator.
- Click Show navigation pane.
- Open System Administrator > Users > Users.
- Select the user for testing.
Note: This must be an AAD user from your domain that you know the password for.
- Once in the user, unassign all roles except Employee and System User.
- In the action pane, click Assign Roles > Select Fleet management branch manager.
- Click OK.
- Log out of Dynamics 365 for Operations.
Testing the Interface
- Open Dynamics 365 for Operations as the assigned user.
- Open the Fleet management
- Click Crazy Lucky Result Decision Maker under Rentals.
- The following are the results for the FMManager. Notice the ability for edit and delete, plus the capability to run the Magic 8 Ball.
- Close the form.
- 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