How to Color code data records using configurable colors for easy identification in Dynamics 365 For Finance & Operations
Have you ever come across requirements where business often wants easier ways of identifying data records in certain status with specific color coding of the records? For example you might want to see all Approved Sales or Purchase orders marked in “Green Color”, and all Rejected/In Review sales orders marked in Orange/Red color. This was just an example to name, but think of applying this to any real time business scenario !!
Our experts have handled these requirements for some of our customers in our recent projects and one of our team members shares his experience here in this post.
In D365 Finance and Operations, let’s assume there is scenario where in the form grid lines need color coding based on the value of a specific data field whose color code can be selected as a setup, Example – Status Codes.
WinApi is the main class that gets used to achieve this in Dynamics AX2012. But with the deprecation of most of this class methods especially related to color picker in D365 Finance and Operations, we may need to use a new class called ColorSelection.
Implement the below logic / steps to accomplish this in D365 Finance and Operations.
Table Field – CColor
Create a new integer field by extending the standard EDT CColor in any table where the color code needs to be stores as a setup.
Setup Form –
Add an Form integer control to populate a lookup and select the color through a color picker.
Set the control properties as –
- Auto Declaration – Yes
- Lookup Button – Always
- Show Zero – No
Create three methods as –
· Lookup – Overridden method on the form integer control.
· SetColor – New Edit method at data source level.
· Active – Overridden method at data source level.
Form Control & Properties
Form Control Lookup Method
Form Control Data Method (Edit Method)
Data Source Active Method
Transaction Form –
To apply color code on the transaction form grid records, add the below code by overriding the below method at data source level –
· DisplayOption – Overridden method on the form data source level.
That’s it for this post. Stay tuned for more !!
And, Of course, If you need assistance with this or with anything related to Dynamics 365 or Dynamics AX Services and support, feel free to contact [email protected].