Professional Documents
Culture Documents
•
•
•
Module 1
Data Entities
Module 1: Data Entities
• Overview
• Supported Scenarios
Overview
Normalized Tables (Customer Data)
Electronic Address
Customer (LogisticsElectronicAddress)
(CustTable)
Party-Location
Location roles
relationship
(LogisticsLocationRole)
(DirPartyLocation)
Party-Location Role
relationship
(DirPartyLocationRole)
Entity Model (Customer)
Customer entity
• Account number
• Customer group
• Bank account
• Party Number
• Name
• Primary postal address
• Primary email
• Primary fax
Capabilities of Data Entities
integrations party
enabled
Pre/Post Data
Staging Validation Mapping
processing packages
Data Entity
Categories of Entities
1. Integration scenarios
• Synchronous services (OData)
• Asynchronous integration
2. Business intelligence
• Aggregate data
• Standardized key performance indicators (KPIs)
A Single
Encapsulation Public Simplicity
Contract
Entity Creation Experience
1. Data Entity wizard 2. From tables
Class: DataEntityViewProjectFactory
Method: CreateEntityInProject(string, AXTable, VSProjectNode)
Demo
Business problem
Fleet Management stores customer data in the FMCustomer table and address data in the FMAddressTable table.
To access or update customer information, users must access multiple tables. Instead, we want to create a data
entity that functionally represents customer information, and that can be used to build integration solutions.
Behavioral Properties on Data Entities
Do Don’t
Prefix the name with normal prefixes in Microsoft
Don’t include underscores in names.
Dynamics AX, because of the lack of namespaces.
Add the postfix “Entity” to the name to prevent
conflicts with tables and classes that have the same Don’t use abbreviations in conceptual names.
prefix.
Result: <prefix><ConceptualName>Entity
Naming Guidelines
Data entity field names
Do Don’t
Give the field name a conceptual name that is aligned
Don’t include prefixes in field names.
with the name in the en-us UI.
Add the postfix “ID,” “Number,” and so on, to the name of
Don’t include country/region-specific postfixes in field
a field that is part of foreign keys to prevent collision with
names.
the navigation properties.
Don’t include underscores in field names.
Don’t use abbreviations in field names.
Naming Guidelines
Data entity relation role names
Do Don’t
Use the plural form when you name roles that have a
Don’t include prefixes in relation role names.
cardinality that is higher than 1.
Use the singular form when you name roles that have a
Don’t add the postfix “Entity” to relation role names.
cardinality of 0 (zero) or 1.
•
•
Virtual Fields
•
•
•
•
Properties of Un-Mapped Fields
Default
Category Name Type Behavior
value
X++ X++
Write
(override mapEntityToDataSource) (override mapEntityToDataSource)
•Data types
•Is called automatically from OData
•Mandatory relationships (both tables and
•Is called by the form engine when a field is
extended data types [EDTs])
DataEntity.ValidateField modified
•Any custom validation
•Isn’t called automatically if an insert/update
•Doesn’t call validateField for underlying
is fired from X++ code
mapped table fields
mapEntityToDataSource
Validations : Table-Based Validation Behavior
Validations : Table-Based Validation Behavior
Validations : Table-Based Validation Behavior
Validations : Table-Based Validation Behavior
Validations : Table-Based Validation Behavior
Validations : Table-Based Validation Behavior
Validations : Table-Based Validation Behavior
Defaults : Initializations
initializeDataSource
(Happens with company
context)
Defaults: Initializations
Defaults: DefaultRow
Module 3
Using Data Entities
Module 3: Using Data Entities
• Access Data Using X++
• Access Data Using OData
Access Data Using X++
Access Data Using X++
•
•
•
•
Demo
public static void main(Args _args)
{
FMLabCustomerEntity customer;
str license = "License";
Random r = new Random();
int rand = r.nextInt();
license = license + int2str(rand);
ttsbegin;
//Display newly created record
select forupdate customer where customer.DriversLicense==license;
info(strfmt("Found newly created customer '%1 %2' with license %3",
customer.FirstName, customer.LastName, customer.DriversLicense));
customer.FirstName = "John";
customer.update();
ttscommit;
}
Access Data Using
OData
Access Data Using OData
•
•
•
•