How to read data from a production instance in D365 #Dyn365FO

Recently I was trying to find the best way to read only updated/changed data from AX for some entities like customers and vendors in D365. To do this in AX 2012 we would generally get a read only database copy made of  production, enable modifiedDateTime fields and query the recently changed data from that database for our reporting needs but in D365 a cool new feature has been provided called change tracking. Through this you can get AX to push changes to your records to an external database outside of AX. A brief overview of this is that we use data entities to list what we need pushed out and configure them to export to our database. Read more on this here: https://docs.microsoft.com/en-us/dynamics365/unified-operations/dev-itpro/data-entities/entity-change-track

In Data management:

Register read only DB outside AX, providing its connection string:

 

Change tracking options:

Advertisements

Error on MPOS sync jobs #Dyn365FO

Errors:

Failed try of uploading data package to blob storage, error message: System.Reflection.TargetInvocationException has been thrwon

connection could be made because the target machine actively refused it

The change tracking information related to scheduler job 1090 and channel database group Default are only partially available, due to the headquarters data base change tracking retention period settling.

 

Solution:

Make sure your azure emulator is running.

How to check which IIS your AX Finance and Operations web App is hosted on in D365 #Dyn365FO

This can be done by going through the web.config xml file which is located at  “X:\AOSService\webroot”. Several parameters are configured here for for the application and i’ll go through some below, as a developer or administrator of Dynamics AX it is essential to know what configs are set here, so do give it a read and go through each element.

Hosting configs:

<add key=”Infrastructure.HostName” value=”usnconeboxax1aos.cloud.onebox.dynamics.com” />
<add key=”Infrastructure.HostUrl” value=”https://usnconeboxax1aos.cloud.onebox.dynamics.com/&#8221; />
<add key=”Infrastructure.SoapServicesUrl” value=”https://usnconeboxax1aos.cloud.onebox.dynamics.com/&#8221; />
<add key=”Infrastructure.InstanceEndpointIPAddress” value=”localhost” />
<add key=”Infrastructure.MaxInstanceEndpoint” value=”10010″ />
<add key=”Infrastructure.MinInstanceEndpoint” value=”10000″ />
<add key=”Infrastructure.PersistentVirtualMachineIPAddress” value=”localhost” />

Package directory folder settings:

<add key=”Aos.AppRoot” value=”C:\AOSService\webroot” />
<add key=”Aos.PackageDirectory” value=”C:\AOSService\PackagesLocalDirectory” />

Database info in the file:

<add key=”DataAccess.Database” value=”AxDB” />
<add key=”DataAccess.DbServer” value=”localhost” />
<add key=”DataAccess.SqlPwd” value=”XXX” />
<add key=”DataAccess.SqlUser” value=”axdbadmin” />

 

Creating a Data entity to export records for a Date effective Table in Dynamics 365 #Dyn365FO

When creating a data entity for a data effective table there are a few properties we need to consider for our imports and exports to work correctly. There can be two scenarios.

1. Data entity is not date effective but one or more data sources within the entity are date effective.

For example we have to export details of a Party record. Now the Party record is saved under DirPartyTable that is not date effective but its First, Middle and Last names are stored in DirPersonName table that is date effective. In order to make sure that we get the latest names of this party while exporting data we need to configure the entity to do so, else it will send whatever record is first in DirPersonName against the party record. To configure it we simply need to set the Apply Date Filter Property to Yes for DirPersonName and make sure we add the ValidTo and ValidFrom fields of DirPersonName datasource to the entity field list.

Parent data source DirPartyTable, not DateEffective:

 

Child data source DirPersonName, that is date effective:

2. Data entity is date effective

What this means is that our data entity has at least one date effective data source and itself implements the date effective framework. Keeps track of latest and old records rather than overriding existing records on update. Will discuss this further in my next blog.

For more information about date effectivity in data entities see: Date effectivity

Solution: Cant see w3wp.exe process to attach for debugging #D365 code

 

If you are unbale to find the w3wp.exe process that we attach our VS debugger to inorder to step through X++ on D365. Chances are the windows logging service is not running. The service name to check is W3C Logging Service start this service by going to services.msc and reopen/refresh the process list.

 

P.s Also make sure your World Wide Web Publishing service is running. Without which your D365 client wont be hosted as well.

For more details on how to debug D365 have a look at the MS blog: Quick and easy debugging in AX 7

Resolving: Error System.InvalidOperationException: Unable to recycle AppPool ‘AOSService’ running Site ‘AOSService’.

Recently I came across an error while doing a complete build on D365

365poolerror

Error :

Severity Code Description Project File Line Suppression StateSeverity Code Description Project File Line Suppression StateError System.InvalidOperationException: Unable to recycle AppPool ‘AOSService’ running Site ‘AOSService’. Check your IIS/Azure Environment for correct deployment. —> System.Runtime.InteropServices.COMException: The object identifier does not represent a valid object. (Exception from HRESULT: 0x800710D8)   at Microsoft.Web.Administration.Interop.IAppHostMethodInstance.Execute()   at Microsoft.Web.Administration.ConfigurationElement.ExecuteMethod(String methodName)   at Microsoft.Web.Administration.ApplicationPool.Recycle()   at Microsoft.Dynamics.Framework.Tools.AosAppPoolRecycler.RecycleAppPool()   — End of inner exception stack trace —   at Microsoft.Dynamics.Framework.Tools.AosAppPoolRecycler.RecycleAppPool()   at Microsoft.Dynamics.Framework.Tools.BuildTasks.SyncEngineWrapper.Sync(CancellationToken cancellationToken) 0

Solution: 

To verify that an application pool has recycled correctly, follow these steps:

Open Internet Information Services (IIS) Manager as an administrator.

In Connections pane, expand your computer name.

Open Application Pools

Find the AOSService pool and if it is stopped, start it.

app pool

 

Debugging without a startup project or startup Object in D365

To debug without setting up a startup project and startup object in D365 fotr operations. Follow these steps:

  1. Open your object in visual studio
  2. Place breakpoints
  3. Goto Debug>attach to process and check show processes from all users
  4. Select w3wp.exe and click attach.

DebugWithoutStartupObject

You can execute your process now from the client and execution will be stopped at your breakpoints.

 

Breakpoint symbols not loading AX7/D365

Recently faced a problem where my breakpoints weren’t loading for objects in the AOT that were not in my solution and therefore I could not debug.

Solution: In order to load symbols for objects that have not been included in your solution you have to uncheck the following check box.

Dynamincs365>Options>Dynamics 365>Debugging
Load symbols only for items in the solution

BreakpointsNotLoadingD365

To know more about how to debug in D365 visit: Debug X++