Author Archives: Deepak Kalra

About Deepak Kalra

Technical Lead Senior Consultant in Dynamics AX(2012,2009,4.0,3.0)

How to Add Main Account Lookup on form by using Segmented Entry Control

Hello Everyone,I would be posting a method through which we need not to write a single line of code to achieve the Main Account lookup.

I will explain in very easy steps which handles the Main Account lookup and Financial dimensions(Main Account- Cost Center-Business- Purpose) lookup.

We had a requirement that to add a Lookup of Main Account on Account Receivable Parameters( Table Cust Parameters).


In Dynamics 365 for Finance and Operations, we can achieve this  by using segmented entry control .

What’s Segmented Entry Control ? The segmented control consists of a dynamic number of elements(segments ).The number of segments may vary depending on the setup, and their lookup values may depend on the values specified in other segments in the same control like Main Account- Cost Center-Business- Purpose.

So we will add segmented entry control to show an account number and related dimensions from the chart of accounts on our form.

Lets start with the steps how to quickly get this working on Dynamics 365 for Finance and Operations form.

1.Create an extension of Table CustParameters with name “CustParameters.Extension” and foreign Key Relationship with Table DimensionAttributeValueCombination.


You will see an additional field with Name “LedgerDimension” after foreign key relation


2.Now set below properties on newly added relation

  • Table- DimensionAttributeValueCombination
  • Index- RecId
  • RelatedTableCardinality- ExactlyOne
  • Cardinality- ZeroMore
  • Relationship type- Association
  • Related table role – DimensionAttributeValueCombination
  • Role- DimensionAttributeValueCombination_CustParameter
  • UseDefaultRoles -No
  • Name :LedgerDimension

3.Now we will add an new control “SegmentedEntry ” on Account Receivable Parameters form extension “Custparameters.Extension”  and set below properties

  • Set control name “MainAccount”.
  • Data source CustParameters
  • Filter expression %1
  • Auto declaration Yes
  • Reference field LedgerDimension
  • Controller class LedgerDimensionDefaultAccountController
  • Label “Main Account”

The segmented entry control always uses the controller class, which handles the entry and display in the control.In addition, If you do not add the controller class to the control, the segmented entry control will not show any information.

We have used  the LedgerDimensionDefaultAccountController class for a segmented entry control that shows main accounts.

Happy Daxing. 🙂

Leave a comment

Posted by on January 24, 2019 in D365O


Tags: , , , , , ,

Port conflict with existing application- D365 Data entity Import/Export Error Unable to start Azure Table Storage

As I posted in previous post, I was getting issue of Azure table storage services while D365 import/ export data through data entity.

Whenever I was facing the above issue then i used to run the BAT file command in previous post  D365 Data entity Import/Export Error Unable to connect to the remote server’ Error with Azure Table Storage.


Suddenly i started getting an error of Port conflict with existing application while starting the services of Azure table storage.

Microsoft Azure Tools: Failed to initialize Microsoft Azure storage emulator. Port conflict with existing application.

By default, Azure storage emulator is using port number 100001000110002 for Blob, Queue and Table services respectively.

If you have existing applications using these port numbers and can’t be changed, you can resolve the port conflict by changing Azure storage emulator default port numbers to avoid port conflict as the steps below:

  1. Stop your Azure storage emulator service
  2. Go to your storage emulator default installation folder, which is located at C:\Program Files (x86)\Microsoft SDKs\Azure\Storage Emulator
  3. Open the AzureStorageEmulator.exe.config file for edit
  4. Edit the default port numbers as shown below enter image description here
  5. Start your Azure storage emulator service.

You should expect the Azure storage emulator to start successfully without any port conflict.

Happy Daxing. 🙂


D365 Data entity Import/Export Error Unable to connect to the remote server’ Error with Azure Table Storage

I was trying to export the data from standard/Custom data entity on my local for D365O and started getting error “No export file found for entity”

When i click on export its shows me executed successfully but when i click on download file it throw me below error

Microsoft.WindowsAzure.Storage.StorageException: Unable to connect to the remote server —> System.Net.WebException: Unable to connect to the remote server —> Sys
Unable to connect to the remote server ---> System.Net.Sockets.SocketException:
No connection could be made because the target machine actively refused it
at System.Net.Sockets.Socket.DoConnect(EndPoint endPointSnapshot, SocketAddress socketAddress)
at System.Net.ServicePoint.ConnectSocketInternal(Boolean connectFailure, Socket s4, Socket s6, Socket& socket, IPAddress& address, ConnectSocketState state, IAsyncResult asyncResult, Exception& exception)
   --- End of inner exception stack trace ---
   at System.Net.HttpWebRequest.GetResponse()
at Microsoft.WindowsAzure.Storage.Core.Executor.Executor.ExecuteSync[T](RESTCommand`1 cmd, IRetryPolicy policy, OperationContext operationContext)
   --- End of inner exception stack trace ---
   at Microsoft.WindowsAzure.Storage.Core.Executor.Executor.ExecuteSync[T](RESTCommand`1 cmd, IRetryPolicy policy, OperationContext operationContext)
   at Microsoft.WindowsAzure.Storage.Table.CloudTable.Exists(Boolean primaryOnly, TableRequestOptions requestOptions, OperationContext operationContext)
   at Microsoft.WindowsAzure.Storage.Table.CloudTable.CreateIfNotExists(TableRequestOptions requestOptions, OperationContext operationContext)
   at Microsoft.DynamicsOnline.Infrastructure.Components.TableAccessor.TableStorageAccessor.PerformOperation(CloudStorageAccount storageAccount, String tableName, Func`1 operation)
   at Microsoft.DynamicsOnline.Infrastructure.Components.TableAccessor.TableStorageAccessor.AddRecord[T](CloudStorageAccount storageAccount, String tableName, T record)
   at Microsoft.DynamicsOnline.Infrastructure.Components.SharedServiceUnitStorage.SharedServiceUnitStorage.CreateData(SharedServiceUnitStorageData data, Boolean setDirectPathWhenAvailable)
   at Dynamics.AX.Application.DmfDataPopulation.`getBlobWriteUrlInCategory(Guid _fileId, String _fileName, Boolean getDirectBlobLinkWhenAvailable, String category) in xppSource://Source/ApplicationFoundation\AxClass_DmfDataPopulation.xpp:line 153
   at Dynamics.AX.Application.DmfDataPopulation.getBlobWriteUrlInCategory(Guid _fileId, String _fileName, Boolean getDirectBlobLinkWhenAvailable, String category)
   at Dynamics.AX.Application.DmfDataPopulation.`getAzureBlobWriteUrl(Guid _fileId, String _fileName, String category, Boolean @category_IsDefaultSet) in xppSource://Source/ApplicationFoundation\AxClass_DmfDataPopulation.xpp:line 111
   at Dynamics.AX.Application.DmfDataPopulation.getAzureBlobWriteUrl(Guid _fileId, String _fileName, String category, Boolean @category_IsDefaultSet)
   at Dynamics.AX.Application.DmfDataPopulation.getAzureBlobWriteUrl(Guid _fileId, String _fileName)

 at Dynamics.AX.Application.DMFGenerateSSISPackage.`generateFileDataV2(DMFDefinitionGroupExecution _dmfDefinitionGroupExecution, String _defGroupName, DMFFileFormat _fileFormat, DMFDelimiter _rowDelimiter, DMFDelimiter _columnDelimiter, String _codePage, String _locale, NoYes _isFirstRowHeader, NoYes _unicode, String _source, String _textQualifier, DMFXMLStyle _style, String _rootElement, String _filePath, Map _entitySyncVersion, Int32 _previewCount, Boolean @_entitySyncVersion_IsDefaultSet, Boolean @_previewCount_IsDefaultSet) in xppSource://Source/ApplicationFoundation\AxClass_DMFGenerateSSISPackage.xpp:line 1073
Request Information

This is because of cache of azure blob storage or azure store emulator stopped working.

This will appear when you try to export/ import the data from D365 or with recurring scheduled import/export job as well.


You can create an BAT File and run as administrator on your D365 VM machine.

SET emu="%programfiles(x86)%\Microsoft SDKs\Azure\Storage Emulator\AzureStorageEmulator.exe"
%emu% stop
%emu% clear all
%emu% start

This will clear out the blob storage and restart the emulator.


Reference Articles:



Tags: , , ,

Reset Production order status through x++ code

My Dynamics Space

On recent enhancement there was a scenario that for some condition I need to reset the production order status from Estimated/Scheduled to created and need to delete the production order. The reference to this production order also should be removed from sales order.

I wrote the following code




ProdTable = prodtable::find(_prodId, true);

If (prodTable)


prodTable.prodStatus = ProdStatus::created;

if (prodTable.validateWrite())







checkFailed(strFmt(@”Delete of Production order %1 is failed.”, _prodId));


after resetting this I deleted the production order using delete_from and it deletes the coproduct records too.

I thought it worked fine. But actually it deletes the Production line reference from inventory transaction and not co-product reference from inventory transaction. Filter the production order that was reset recently in IM > Inquiries > Transaction. you can see the co-product reference is not deleted.

So I debugged more and I found the right code…

View original post 102 more words

Leave a comment

Posted by on April 23, 2018 in Uncategorized


[D365/AX7] How to: Create simple Dialog using RunBase

[D365/AX7] How to: Create simple Dialog using RunBase

DAX Beginners

A few years ago, I made a post about How to: Create a simple Dialog through X++, today I will review my code and make it work on D365FO.

View original post 98 more words

Leave a comment

Posted by on April 23, 2018 in Uncategorized


Filter Invent On -Hand based on WMSLocation


Today I have faced a issue how to show or filter data on InventSum Grid in EP from WMSLocation i.e. for each location there should be Invent On-hand data.

Same as AX 2012 R3 rich client in EP.

For these following are the steps:

  1. Create a Dataset EPInventGridOnHand.
  2. Add InventSum and InventDim table in datasource of EPInventGridOnHand dataset.
  3. Now on init() method of EPInventGridOnHand dataset we will get WMSLocation buffer with InventLocationId and WmsLocationId field value and write below code before dataset Init method super()


wmsLocation = element.args().record(); // Here wmsLocation is a global table buffer

For filtering based on WMSLocation write below code after dataset init method super()

               //Filter Invent On-hand based on WMSlocation

inventDim_ds.query().dataSourceTable(tableNum(InventDim)).addRange(fieldnum(InventDim,wmsLocationId)) .                                   value(queryValue(wmsLocation.wMSLocationId));

inventDim_ds.query().dataSourceTable(tableNum(InventDim)).addRange(fieldnum(InventDim,InventLocationId)) .    …

View original post 55 more words

Leave a comment

Posted by on March 9, 2017 in Uncategorized


To Debug Ax Service Operations Framework

To debug the Dynamics Ax, service operations (SysOperationService) framework, change the following method as follows…

Classes –> SysOperationRPCFrameworkService –>runServiceOperation


/*return SysDictClass::invokeStaticMethodIL(classStr(SysOperationServiceController),

                                        staticMethodStr(SysOperationServiceController, runServiceOperation),

                                        [controllerClassId, packedController]);*/

return SysOperationServiceController::runServiceOperation([controllerClassId, packedController]);

Credit :



Tags: , , ,