Tables in Dynamics 365 FO and Their Equivalents in SQL Database

·

3 min read

Components of Tables in D365 FO

In a regular SQL database, the components of a table in Dynamics 365 Finance & Operations (D365 FO) have similar counterparts, though some are more advanced due to the application framework. Here's a comparison:

1. FieldsColumns

  • In SQL, a field in D365 FO is equivalent to a column in a relational database table.

  • Fields store actual data and have data types (integer, string, date, etc.).

  • Extended Data Types (EDTs) and Base Enumerations in D365 FO add abstraction, similar to SQL's domain constraints or ENUM types.

2. Field GroupsNo direct SQL equivalent

  • Closest equivalent: Views or Aliases

  • SQL does not have field groups at the schema level, but views can be used to group columns logically for querying.

  • In applications, field groupings can be managed through schemas or data abstractions.

3. IndexesIndexes

  • Works the same way in SQL databases.

  • Used to improve query performance and enforce uniqueness (Primary Key, Unique Index, etc.).

4. RelationsForeign Keys (FK)

  • Relations in D365 FO are similar to Foreign Key Constraints in SQL.

  • They define dependencies between tables, ensuring data consistency.

5. Delete ActionsON DELETE CASCADE / SET NULL / RESTRICT

  • In SQL, DELETE actions are implemented using ON DELETE rules in Foreign Keys.

  • Examples:

    • ON DELETE CASCADE → Deletes related records when a parent record is deleted.

    • ON DELETE SET NULL → Sets related records' foreign key to NULL instead of deleting them.

6. State MachinesNo direct SQL equivalent

  • Closest equivalent: State transition tables or Triggers

  • State Machines in D365 FO handle workflows and transitions (e.g., Order → Shipped → Delivered).

  • In SQL, state transitions can be implemented via status columns, lookup tables, or triggers that enforce allowed changes.

7. MappingsViews, Joins, or ETL Processes

  • Mappings in D365 FO allow fields from different tables to be accessed using a common name.

  • In SQL, this is typically done using Views, Joins, or ETL (Extract, Transform, Load) processes.

8. MethodsStored Procedures / Functions / Triggers

  • D365 FO allows methods to be attached to tables for business logic execution.

  • In SQL, similar functionality is achieved using Stored Procedures, Functions, or Triggers.

9. EventsTriggers

  • Events in D365 FO are similar to Triggers in SQL, which execute code automatically before/after insert, update, or delete operations.

Summary of SQL Equivalents:

D365 FO ComponentSQL Equivalent
FieldsColumns
Field GroupsViews, Aliases
IndexesIndexes
RelationsForeign Keys
Delete ActionsON DELETE CASCADE / SET NULL / RESTRICT
State MachinesTriggers, Status Columns
MappingsViews, Joins, ETL
MethodsStored Procedures, Functions, Triggers
EventsTriggers

Would you like further clarification on any of these mappings?