In Dynamics 365 for Finance and Operations, the color selection dialog boxes are used in various places, allowing the user to select and store a color code in a table
field. Then the stored color code can be used in various places to color data records, change form backgrounds, set colors for various controls, and so on.
In this recipe, we will create a color
lookup. For demonstration purposes, we will add an option to set a color for each legal entity in the system.
- In the AOT, open the
CompanyInfo
table and create a new field with the following properties:
Property | Value |
Type | Integer |
Name | CompanyColor |
ExtendedDataType | CCColor |
- Open the
OMLegalEntity
form, locate theTopPanel
group inDesign
|Tab
|General
, and add a newIntEdit
control with the following properties to the bottom of the group:
Property | Value |
Name | CompanyColor |
AutoDeclaration | Yes |
LookupButton | Always |
ShowZero | No |
Label | Company color |
- In the same form, create a new method with the following code snippet...