D365 Mystery Hosting Explained #Dyn365FO

Mystery: IIS was stopped but D365 app was still running. How could this be? Its a single box Azure VM and everything, not just the AOSService but ISS itself is off. I verified the app is connecting to the right database and verified the webconfig file points to my own server so some other machine could not be hosting the App, I checked all configurations and none point to a different server so what magic is going on here.

 

I’m sure this would not be a mystery for everyone but for a short time it became a mystery to me and might become to some others as well so I had to get to the bottom of the magic happening. After some research I got to know that after the recent platform update 12 D365 is hosted on IIS Express, and as you know IIS express runs on visual studio, so if you have Visual studio open your app will be hosted. I ran a few scenarios after this so here is a list of them.

 

  1. If Visual Studio is open, your IIS is stopped, D365 would still run on based on IIS Express.
  2. If Visual Studio is closed, your IIS is stopped, D365 url will give you a Service Unavailable error
  3. If Visual Studio is closed, IIS is running, D365 will run based of your AOSService site.
  4. If Visual Studio is Open, IIS is running, D365 will run.

Thanks to a post by Faisal here which lead me to this. It explains what else was done wrt to update 12 like elimination of Admin user on lcs and availability of a Developer user.

 

Mystery Solved!

 

Address and contact information table relationships to a party in #AX2012 & #Dyn365FO

Both address and contact information on a customer, vendor or any party record is stored at the party level. So while the parties Customer and Vendor are company specific the party record is cross company. If you create a customer against the same party in two companies and modify the address of Customer A in company X you will see the changes for Customer B in company Y. This is because when we are modifying a customers address or contact, it is actually modifying the party address and contact. You can test this out without getting into the development environment by creating a customer in one company with an address and contact, note down its party number that was created, then create a customer in another company and use the change party association option to assign the newly created customer the party number of the previously created customer. After this, change the address on any one of the customers and you will see the changes reflect on the other company customer as well. Now generally this is not the case as when you create a customer in a company a new party record gets created against it and within AX you always create a customer or vendor first and not a party itself.

Coming down to the technical’s in play for this. A party record is stored in the DirPartyTable and in order to query its locations(addresses/contact information) you can query the DirPartyLocation table which will give out  records that each represent an address and one record that represents all contact information records, to identify these there are NoYes enum fields such as IsPostalAddress. For example if there are 3 addresses on a customer and 5 contact information records, this table will show you 4 records. Each record contains a Location field that represents the RecId of  the LogicticsLocation table, this table contains links to the address and contact information records. Addresses are saved in LogisticsPostalAddress table and contact information is stored in LogisticsElectronicAddress table, each table has as relationship with the LogisticsLocation table as shown below.

Contains 4 records, 3 for addresses and one for contacts:

These records can be used to query the address in LogisticsPostalAddress table below, wrt to the following relationship:

Hopefully this gives you an idea of the crud operations of an address and contact information in AX. This applies to both AX 2012 and D365.

Track Platform and application updates for #Dyn365FO

A good resource to bookmark for any Dynamics 365 finance and operations professional is the Software lifecycle policy and list of releases page to track and get brief updates about platform and application releases with links to their detailed changes. This is updated regularly, last update was made yesterday 25th March 2018 about platform 15 which has a cool new addition of the ability to color grid rows without over laying as well as the application update 7.3.11971.62687

Ref: https://docs.microsoft.com/en-us/dynamics365/unified-operations/dev-itpro/migration-upgrade/versions-update-policy

 

 

Regenerate / Update staging tables in #Dyn365FO Data Entity

Regenerating/ updating a staging table in Dynamics 365 has literally been made as easy as a one click operation but somehow not well documented so I though i’d write a quick overview on how to update or regenerate a staging table based on your Data entity changes.

Open your data entity in visual studio and right click on the entity name like below this will show you the two options. Please note that if you regenerate a table all custom changes you made to that table will be lost. However if you use the update table option, only new changes will be added. For example if you add a field only on staging table and regenerate staging table the custom field will be lost, therefore if you would like to maintain your additions and update, use update staging table option.

Solution: Data Entity synchronization errors in #Dyn365FO

After creating a data entity you might receive the following 15 errors upon building it, these recommend you to do a full build of your package but this will not resolve the issue. The cause of this error is an existing entity record in your DMFEntity table and like some solutions have mentioned that you delete those records and rebuild they will work for only once but when you make changes and run a build again you will get a the same errors, so lets come to what is causing this. It is clear that there is a duplicate but when I verified that there is none according to my Entity name and table names within the DMFEntity table that could cause a duplicate, what could it be? Well to your and my surprise the label you have on your entity is also a factor when it comes to duplication. And since D365 has existing data entities for a number tables out of the box it is quite possible that your new entity that you built got the default table label.

 

Error                Database synchronization failed. You may have to do a full build of the package ‘TrueValue_Retail’ and all of its dependent packages.                        0

Error                at Dynamics.AX.Application.DmfDataPopulation.`syncEntityMetadata(StringCollection dataEntityViewCollection, StringCollection compositeEntityList) in xppSource://Source/ApplicationFoundation\AxClass_DmfDataPopulation.xpp:line 817.’ on category ‘Error’.                        0

Error                Infolog diagnostic message: ‘Error synching entity metadata for entity – TVRetailExportLoyaltyCustomer. Message –    at Microsoft.Dynamics.Ax.MSIL.Interop.throwException(Int32 ExceptionValue, interpret* ip)                        0

Error                Infolog diagnostic message: ‘Cannot create a record in Entity (DMFEntity). Entity: Loyalty card, TVRetailExportLoyaltyCustomerStaging.                        0

 

Solution:

Give your entity a custom label.

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

#D365 Solution: The property ‘ComputedFieldMethod’ must be set with the name of a valid data entity method if ‘IsComputedField’ is set to ‘Yes’.

When adding Unmapped fields(ones we do not intend to link up with any datasource field on the entity itself) to a data entity in Dynamics 365. You may receive the below compile error:

The property ‘ComputedFieldMethod’ must be set with the name of a valid data entity method if ‘IsComputedField’ is set to ‘Yes’.

Solution:

This is because AX is expecting a computed method for it within the entity, when we do not intend to create that we need to Set the Is Computed Field property under Mics group to No

 

 

 

Shrinking a Database Log file through SQL

Often our DB logs grow out of hand and we are left with limited space; a common occurrence on dev boxes for AX. So among other remedies to get more space is shrink your database log files and you can do so by using the queries below. Make sure you back up your databases before you run this, make this a standard practice before changing/modifying any meta on your db servers. You can do this for both your trans and model databases for Dynamics AX 2012.

USE DynamicsAXDev_model;

GO

— Truncate the log by changing the database recovery model to SIMPLE.

ALTER DATABASE DynamicsAXDev_model

SET RECOVERY SIMPLE;

GO

— Shrink the truncated log file to 1 MB.

DBCC SHRINKFILE (DynamicsAXDev_model_Log, 1);

GO

— Reset the database recovery model.

ALTER DATABASE DynamicsAXDev_model

SET RECOVERY FULL;

GO

AX Tables updated when a Pending Vendor Invoice is Posted inside #AX2012

An invoice when posted goes into the following tables:

For Invoice Header:

VendInvoiceJour defaults from VendInvoiceInfoTable

For Invoice lines:

VendInvoiceTrans defaults are from VendInvoiceInfoline table

See bttom to top:


Then a single record is inserted in VendTrans then VendTransOpen, see bottom to top