D365 F&O Developer
Quick Reference
X++ Development
Key patterns:
- Use
selectvswhile selectappropriately —selectfor single record,while selectfor batch - Always use
ttsBegin/ttsCommitfor transactional writes - Prefer
SysDictTable/SysDictFieldover raw schema queries - Use
buf2Buf()for record copying,DictField::extendedFieldType()for EDT lookups
Common snippets:
// Select with field list (avoid SELECT *)
select Field1, Field2 from myTable where myTable.RecId == _recId;
// While select with joins
while select myTable
join myTable2 where myTable2.RefRecId == myTable.RecId
{
// process
}
// Insert with initFrom
myTable2.initFrom(myTable);
myTable2.FieldX = value;
myTable2.insert();
Data Entities
- OData endpoint:
/data/<EntityName>— supports CRUD via GET/POST/PATCH/DELETE - DMF (Data Management Framework):
- Export: Create data project → Add entity → Export to CSV/Excel/Package
- Import: Upload file → Map fields → Import
- Programmatic: Use
DMFDataManagementServiceor OData/data/DataManagementDefinitionGroups
- Key entity patterns:
DataEntity,SysDataEntity, custom entities viaDataEntityAttribute
Integrations
See references/integrations.md for detailed OData, Custom Services, and DMF patterns.
- OData: Standard REST endpoint. Auth via AAD. Service endpoint:
https://<env>.operations.dynamics.com/api/services/UserSessionService/AifUserSessionService - Custom Services: X++ service classes exposed as SOAP/WCF endpoints. Use
SysServiceControllerfor data operations - DMF: Best for bulk data. REST endpoint
/data/DataManagementDefinitionGroups/Microsoft.Dynamics.DataEntities.ImportFromPackage
Security
See references/security.md for XDS and Record Level Security details.
- XDS (Extensible Data Security): Role-based row-level filtering. Constraint-based policies applied via AOT
- Record Level Security: Similar to XDS but applies at the record level per user/role
- Duties & Privileges: Granular permission items. Map to menu items and service operations
Build & Deploy
Hotfix/ISV deployment:
- Export model from Dev environment
- Deploy model package to Build environment
- Run full build pipeline
- Generate deployable package via LCS
CI/CD with Azure DevOps:
- Use D365 F&O Build Automation tasks
- X++ compilation via
xppc.exe - Unit tests via SysTest framework
Error Handling Patterns
try
{
ttsBegin;
// transactional logic
ttsCommit;
}
catch (Exception::Error)
{
ttsAbort;
throw error("Descriptive error message");
}
Performance Tips
- Avoid
SELECT *— always specify field lists - Use
setTimeout(DB_TIMEOUT)for long-running queries - Prefer
insert_recordset/update_recordsetover row-by-row operations - Index hint via
indexkeyword when table is large
References
For detailed guides, read these files as needed:
- Integrations — OData, Custom Services, DMF deep dive
- Security — XDS, RLS, Duties & Privileges