This post will explain what is needed to be performed in target environment when you are planning for refresh database (RDB) process when you use bring your own database (BYOD) export both in source and target environments. In addition, it will clarify how you can re-configure BYOD in target environment after RDB process.
When you use BYOD export in both environments that you are planning for RDB, it is important to take backup of BYOD configuration of target environment so that you can apply it the environment after RDB process. In this regards, following checklist can be used to avoid failing of BYOD export jobs in target environment (e.g. UAT). Please follow To-Do list for task that can be done for RDB process https://dynfotech.com/2021/09/04/refresh-database-to-do-list/ .
Checklist (before RDB):
- Inform users (D365FO team, data warehouse team, CE team) about RDB start time well in advance.
- Take a backup of connection string for target environment BYOD entity store (Workspaces > Data management > Configure entity export to database).

- Create a template of each BYOD data project and export them in your local PC or SharePoint (Workspaces > Data management > Templates). These templates can be imported to the target environment after the RDB.

- Export published entities to the target environment BYOD in Excel via Excel add-In.

- Export active BYOD batch jobs in target environment with their recurrence setup.

- Stop active BYOD batch jobs controlled or update active period so that they will be stopped before RDB.
Checklist (after RDB):
After RDB, connection string from source environment does not work in target environment and you can evaluate to this delete this BYOD entity store.

Note: You will get an error message by validating the connection string: “The ConnectionString property has not been initialized.The connection string should be of format Data Source=serverName;Initial Catalog=databaseName;Integrated Security=False;User ID=userid;Password=***”.
In order to delete this BYOD entity store (i.e. connection string); you need to perform the following task:
- Make sure that BYOD batch jobs are not running and have “Withhold” status.
- Just-In-Time access to target environment database via connecting to SQL Server using SSMS via LCS (i.e. No downtime is needed).
- Purge “Job history” table and related tables by running SQL Query on AX db. This will cleanup records that are stale in staging and execution history tables For example:
- DMFSTAGINGVALIDATIONLOG
- DMFSTAGINGLOGDETAILS
- DMFSTAGINGLOG
- DMFSTAGINGEXECUTIONERRORS
- DMFDEFINITIONGROUPEXECUTIONHISTORY
- DMFEXECUTION
- DMFDefinitionGroupExecution
- Truncate “DMFPublishedEntity” table to drop entities that has been published to the source environment entity store in target environment by running SQL Query on AX db.
Note: After running the truncate query, those entities which have “Published = Yes” will be updated to “Published = No”

- Delete all data projects on data management or just delete those relating to source environment BYOD data source.

- Delete BYOD entity store connection string.

- Delete old BYOD batch jobs (i.e. source environment BYOD batch jobs).
- Refresh entity list on the target environment (Workspaces > Data management > Framework parameters):

- When the entity list has been refreshed, configure an entity export option for the target environment and then publish the required entities against it.
Note: You need to define correct connection string for target environment.
Note: Click on validate on the BYOD entity store to makes sure that the connection is working.

Useful links:
https://docs.microsoft.com/en-us/dynamics365/fin-ops-core/dev-itpro/analytics/export-entities-to-your-own-database https://docs.microsoft.com/en-us/dynamics365/fin-ops-core/dev-itpro/sysadmin/cleanuproutines
Can you please advise, how can I find DataEntities for export for Production, Purchase and Sales.
If I want to create a Data Entity, which “Model” I need to select to see the relevant tables (using Visual Studio).
Greatly appreciate your help.
LikeLike
Hi Azhar, If you mean sales order and purchase order, you can use following standard entities:
-Purchase order headers V2
-Purchase order lines V2
-Sales order headers V2
-Sales order lines V2
In order to create a custom entities in D365FO, you can follow the steps via following post on Microsoft docs:
https://learn.microsoft.com/en-us/dynamics365/customerengagement/on-premises/customize/create-entities?view=op-9-1
https://learn.microsoft.com/en-us/dynamics365/fin-ops-core/dev-itpro/data-entities/build-consuming-data-entities
LikeLike
Dear Ali Reza, thank you so much, actually there entities which are not exposed for OData, so want to do that.
Secondly for Production Entities, can you provide any insights.
2) If I want to create New Entities, which MODEL I need to select for Sales, Purchase and Production data.
3) If any customization is done in Forms, that will also be available in Data Entities, or do we need to created them.?
Thank you so much.
best regards
LikeLike
Hi Azhar, you can use following ODATA entities.
-SalesOrderHeadersV2
-SalesOrderLines
-PurchaseOrderHeadersV2
-PurchaseOrderLinesV2
-ProductionOrderHeaders
Have you tried following entities?
For example: https://D365FOURL/data/PurchaseOrderLinesV2?$filter=dataAreaId='CompanyID‘
You can use expand function to get both header and line: https://D365FOURL/data/SalesOrderHeaders?$filter=SalesOrderNumber eq ‘SO-000001’$expand=SalesOrderLine
2)Do you mean to use own package model? https://learn.microsoft.com/en-us/dynamics365/fin-ops-core/dev-itpro/dev-tools/models#creating-a-new-model
It’s possible to copy an entity and using “Duplicate in project” in Visual Studio.
If you want to add new fields to standard data entity, you can Instead of duplicating the data entity, you can create a new model and new solution with a project where you can create an extension on top of the standard data entity. You are able to add fields using an extension.
3)The new new custom entity will be available in the environment once you refresh data entities.
LikeLike
Dear Ali Reza
The below are visible and I can extract data
SalesOrderHeadersV2
-SalesOrderLines
-PurchaseOrderHeadersV2
-PurchaseOrderLinesV2
But ProductionOrderHeader is not visible, please advise.
Secondly as question previously, using Visual Studio, (SSDT), I want to expose any entity which does not seem visible. How I can do that. Which MODEL selection would give me access to those list of entities.??
Thank you so much for your responses.
Best regards
LikeLike
You need to choose ODATA entity ProductionOrderHeaders (https://D365FOURL/Data/ProductionOrderHeaders)
LikeLike
Thanks
below links are not working for me.
https://D365FOURL/data/PurchaseOrderLinesV2?$filter=dataAreaId='CompanyID‘
Please advise.
LikeLike
Hi Azhar, Please try
https://D365FOURL/data/PurchaseOrderLinesV2?$filter=dataAreaId eq ‘CompanyID‘
LikeLike
Thanks, these are the ones I have been using. But for entity to be exposed for odata, which MODELS, I need to select in visual studio to create.
LikeLike
Hi Azhar, You need to use the same model that the original entity has. For example, you can use “Application suite” for Sales order line V2:
LikeLike
Greatly appreciated, thanks and best regards
LikeLike
Thanks, by the way the links are not working still.
https://d365fourl/data/PurchaseOrderLinesV2?$filter=dataAreaId
This domain is not being resolved by DNS (D365fourl)
LikeLike