Dynamics 365 finance and operations OData Posting using Postman tool

In recent times, OData is being used heavily for reading/writing operations. And testing the data entities is a crucial step to finding the entity behavior with different data payloads.

OData is a standard protocol for creating and consuming data.

There are many tools available to test these CRUD (create, update, delete) operations. Recently I used Postman and found it very handy and easy to use provided all configurations are in-place. Prior to using Postman, I extensively used Fiddler but it requires manual steps. I found Postman more useful compared to Fiddler.

Microsoft has a very useful article about setting up Postman to test data entities – https://docs.microsoft.com/en-us/dynamics365/fin-ops-core/dev-itpro/data-entities/third-party-service-test

Assuming you have downloaded the postman desktop application for Windows-64bit and installed it appropriately.
It will ask you to sign in. I used a Gmail account to sign in.

The high level process steps are –

1. POST to a URL to generate access token.
2. Use generated access token for the CRUD operation.

NOTE: Click to the image to see enlarged version. Thumbnail images are shown on the page, and they are not quite obvious or clear.

Step 1A – Create an environment and variables to hold environment related values.

Left section contains all the F&O environments. Each environment configuration holds following information against a variable, and then variable is being referenced during POST or GET Commands.

Two columns exist in here.
Initial value:default values for the environment, if column current value has no values. If Current Value column has information available, then it will be used during execution.

Step 1B – POST to a URL to generate access token.

Green dots are tabs where you will find some information related to the environments that you must configure for successful post and generation of access token.

Since I have multiple environments and each one has different values for variables: client_id, secret and resource url, before running this step, I need to choose correct environment. It is highlighted in the red rectangle in below image.

Click Send button next to the URL to execute the POST operation. And if authentication is successful, then the generated output will look like this.
Important values to check are –
  • Response type: 200 OK
  • Output type: JSON
  • Body section – in JSON format. And for POST operation, access_token is required field.

    NOTE: POST Login API, that is generating the access_token, has body section and it has javascript that is setting the environment variable bearerToken with the value generated by this POST operation and the value of access_token automatically.
    Now I have to do my actual GET operation for the selection environment.

  • Intention – Get me Sales order lines using CDS Sales order lines V2 data entity from the selected environment/url based on the parameters provided.
  • Define parameters in Params section. Define Key/value pair combinations as listed.
  • Click Send button
  • Postman will reach out to the URL and will generate the output in the Body section. As you can see, the response code in blue rectangle is 503 Service unavailable. It means website is not running. Connect to the box and reset IIS from command prompt (run as administrator), type iisreset and hit ENTER. This will restart the box and website should be accessible after 1-2 mins.
  • Try again after 1-2 minutes.
  • Steps: first run the POST Login Operation to generate the new access_token, and then second run the GET operation.

    Get Operation request/response may take some time to return the result because environment URL was originally not accessible, so F&O begins caching operations behind the scene which slows down the response generation process for couple of minutes.

    Points to ponder

  • Response: 200 OK. This is HTTP Response. List of HTTP Response codes can be found here: https://developer.mozilla.org/en-US/docs/Web/HTTP/Status
  • Response time: For this get operation, as indicated, took 1 minute 46 seconds, but generally responses are quick and typically in milliseconds.

    POST (insert operation) and errors and interpretations

    Scenario: Authentication is successful, however, operation failed with error:

  • 400 bad request: scroll all the way down to the message inner exception. Something like this: “internalexception”: { “message”: “The property ‘CURRENCYCODE’ does not exist on type ‘Microsoft.Dynamics.DataEntities.CDSSalesOrderLineV2’. Make sure to only use property names that are defined by the type.”, “type”: “System.InvalidOperationException”, “stacktrace”: ” at Microsoft.Dynamics.Platform.Integration.Services.OData.AxODataEntityDeserializer.ReadODataBody[T](HttpRequestMessage request)” }

    Issue & Solution:
    Because the field is in CAPITAL form, so change it to CurrencyCode instead of CURRENCYCODE. And run the POST operation again. But you will get another error.

  • 403 Forbidden: It means the intended operation is not allowed. Check inner message.
    “innererror”: { “message”: “insert not allowed for field ‘CurrencyCode'”, “type”: “Microsoft.Dynamics.Platform.Integration.Services.OData.ODataSecurityException”, “stacktrace”: ” at Microsoft.Dynamics.Platform.Integration.Services.OData.Update.UpdateProcessor.CreateEntity_Save(ChangeOperationContext context, ChangeInfo changeInfo)\r\n at Microsoft.Dynamics.Platform.Integration.Services.OData.Update.UpdateManager.c__DisplayClass10_0.b__1(ChangeOperationContext context)\r\n at Microsoft.Dynamics.Platform.Integration.Services.OData.Update.ChangeInfo.ExecuteActionsInCompanyContext(IEnumerable`1 actionList, ChangeOperationContext operationContext)\r\n at Microsoft.Dynamics.Platform.Integration.Services.OData.Update.ChangeInfo.TrySave(ChangeOperationContext operationContext)\r\n at Microsoft.Dynamics.Platform.Integration.Services.OData.Update.UpdateManager.SaveChanges()\r\n at Microsoft.Dynamics.Platform.Integration.Services.OData.AxODataDelegatingHandler.d__3.MoveNext()” }
    Issue & Solution:
    Remove the added “CurrencyCode” field from the Body, and try again. And this time it should be successful with HTTP response code 201 Created.

    Environments: F&O: Update49, version: 10.0.25
    POSTMAN: v9.18.2
  • Posted in Data Entity, Dynamics AX 365 for operations, OData Protocol | Tagged , | Leave a comment

    Azure Data Factory showing “invalid git configuration” error

    Problem scenario: Azure developer wanted to make an update to the Azure data factory. When connected to the data factory, he got this issue of “Invalid Git Configuration”.

    Invalid GIT configuration. You need to gain access to the repository before you can publish any changes.

    Solution (that resolved the primary issue):
    Azure DevOps admin added “user account” into Azure DevOps “Organization setting” using “Basic” license.

    Steps –
    1. Go to Azure DevOps (Root)
    2. Organization settings (bottom left)
    3. On the left navigation tree, “General” heading, Click Users.
    4. Check user (having connection problem) exist in there with “Basic” Access Level. If not, add the user in here.

    Details –
    In my case, developer credentials did exist in AAD, and permission was granted across except at Organization settings.

    Posted in Uncategorized | Tagged , , | Leave a comment

    Microsoft.Dynamics.Ax.Xpp.ErrorException: Failed to create a session; confirm that the user has the proper privileges to log on to Microsoft Dynamics 365 for Finance and Operations.

    Recently, applying binary updates to Tier-2 environment, IT department reported this issue to me, that it is failing at Step 20 with error :

    “Microsoft.Dynamics.Ax.Xpp.ErrorException: Failed to create a session; confirm that the user has the proper privileges to log on to Microsoft Dynamics 365 for Finance and Operations.”

    So this error is related to user privilege. Because DBSync runs under Admin365 user account. So it is essential to check this admin user privilege in correct table. And the correct table is UserInfo. So when I troubleshooted this issue, and checked UserInfo table, I found field ‘Enabled’ field value was 0. Means this admin user privilege was not enabled. So used this SQL query to update the field value.

    select RecId from PARTITIONS where PARTITIONKEY = 'INITIAL'

    from USERINFO
    Where PARTITION = 5637144576 and ID = 'Admin'
    begin tran
     update A
     Set A.ENABLE = 1
     From UserInfo A
     Where PARTITION = 5637144576 and ID = 'Admin'
    rollback tran

    Environment: Release 7.2 Update 12.

    Posted in Dynamics AX 365 for operations | Leave a comment

    Using Fiddler to check OData Entities

    Environment – Dynamics 365 for finance and operations, Release 7.2, Update 12

    So the big challenge for X++ developers is how to check the data entities that are published via customized code or even standard.

    Use Fiddler.

    Data entity property IsPublic = Yes, it means that data entity is accessible via OData. But data entity is accessible via public collection name. For example, Customers V2 entity (Target entity name is CustCustomerV2Entity) is accessible via OData as https://<axbaseurl>/data/CustomersV2

    And if you have thousands of records, and you want filtered results, then you can add $filter criteria as well.

    Example 1: If requirement is to list top 100 customers across all legal entities (assuming there exist more than one legal entity)

    URL: https://<axbaseurl>/data/CustomersV2?$top=100&cross-company=true.

    Example 2: If requirement is to list top 100 customers in just one legal entity.

    URL: https://<axbaseurl>/data/CustomersV2?$top=100&$filter=dataAreaId eq ‘USMF’

    Now there is a requirement to do some insert or update operation on a data entity. It is simple, yet, process driven.

    Step 1. Authentication. For authentication, it is required to create an azure based application. Once this application creation is done, then you will get your ‘Client ID’ (or it is known as Application ID as well in azure portal for the application) and then you can generate (& Save) Client secret key as well. Both ‘ClientID’ and ‘Client Secret Key’ is required for Fiddler process.

    Step 2. Registering and authorizing this application ID (or client ID) in Dynamics environment. Ensure that this ‘Client ID’ exist in Dynamics environment: Modules > System administration > Setup > Azure active directory applications. If record does not exist on the form, create a new one with details about Client ID, name:, and user Id. Ensure User ID = Admin.

    Once you have above 2 steps completed, then you are ready for Fiddler action. It is once again 2 step process.

    Step 1a. Get access_token, which is authorization key.

    Step 2a. Use step 1 generated access_token in the GET or POST (insert operation) or PATCH (update operation) queries.

    Step 1a. Get access_token query

    POST https://login.windows.net/<tenantId>/oauth2/token HTTP/1.1
     Content-Type: application/x-www-form-urlencoded
     Host: login.windows.net

    <tenantId> – you can get this from Azure portal

    <client_id> – as explained in Step 1 above. Client_Id or application Id is same.

    <client_Secret_key> – As explained in Step 1 above.

    How to use this step 1a in Fiddler?

    • Start Fiddler, and ensure that these settings are set appropriately.

    Fiddler settings

    • Before ‘Options’ tab, there is ‘Scratch pad’. This is pretty awesome option where you can save your commands that can be selected and executed. The highlighted text is same as provided in step 1a above.

    Get access_token

    •  Select the highlighted text, and click Execute button. The results would appear as given below. From here, you need to copy the value for tag “access_token” to be used in the next step with GET, POST or PATCH. Note that your scratch pad query is still available under “Composer” tab.

    Access_token executed

    • Assume that you copied the access_token value.
    • Copy this access_token generated from previous screen and paste in the following query that you need to write in Scratch pad.
    GET https://<axbaseurl>/data/Customers?$top=10&cross-company=true HTTP/1.1
    OData-Version: 4.0
    OData-MaxVersion: 4.0
    Accept: application/json;odata.metadata=minimal
    Accept-Charset: UTF-8
    Authorization: Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJSUzI1NiIsIng1dCI6IkZTaW11RnJGTm9DMHNKWEdtdjEzbk5aY2VEYyIsImtpZCI6IkZTaW11RnJGTm9DMHNKWEdtdjEzbk5aY2VEYyJ9.eyJhdWQiOiJodHRwczovL3N0YXJ0ZWNoZGV2YnJhbmNoYW9zLnNhbmRib3guYXguZHluYW1pY3MuY29tIiwiaXNzIjoiaHR0cHM6Leeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee2Q3YWYtYzM4Ni00YTJiLTg3YjAtMTZlNzZhZGRmYjIzLyIsImlhdCI6MTUyMjMwMjg5NCwibmJmIjoxNTIyMzAyODk0LCJleHAiOjE1MjIzMDY3OTQsImFpbyI6IlkyTmdZSGgzNE1XUmczZG03N2x2MVB5aitpZG5IZ0E9IiwiYXBwaWQiOiJkOGY2M2NmYi01MDgxLTQ3MTMtYWMyZS02OGIzZDYzMjYxZDQiLCJhcHBpZGFjciI6IjEiLxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxm5ldC8wYmYzZDdhZi1jMzg2LTRhMmItODdiMC0xNmU3NmFkZGZiMjMvIiwib2lkIjoiZDYwNzdkYzktNzczYS00MWE0LWFkNDAtMjBmZTI5MmMwNTFjIiwic3ViIjoiZDYwNzdkYzktNzczYS00MWE0LWFkNDAtMjBmZTI5MmMwNTFjIiwidGlkIjoiMGJmM2Q3YWYtYzM4Ni00YTJiLTg3YjAtMTZlNzZhZGRmYjIzIiwidXRpIjoiQ1hBWVZWMlpoMC0zTkZNM1M5TUpBQSIsInZlciI6IjEuMCJ9.pgf-hUFLhmadBVC8AXTmvP3IBROC-0tfF-qwYmdppkRbUj-xer-aPfB41Re41vtREOKAtMcmzQip7xtif7HnguDndh104hJZ9qHz-qp-zEQV4BCV-gb9pQw7LDvpwZNpGMGU6jrL2IYGdGTUcuhyNK2ePfInm5_TGpjiP_VKYUNcUZS-PUeGG6lqKL7oJlzlg6nTqbJJa3jXnCA0SbnSQwhyvgGVx97IGMqhQZ1MNNh3J5dHidL_8ubidwbP9FTjByC6rdtWsDWomJhDWe28zPbpS1CoClfvjewm1UII6j0PsPUc8hJwTjsZxmpfq__W9sZ5d7Be9TdqDlouof6vvg
    Host: <axbaseUrl without https>
    • Select this whole text in scratch pad, and click ‘Execute’ button on top right. You will get the results as shown below:

    Get Execute results

    • So in the result, you get JSON with top 10 customer records across all legal entities.

    Example. Inserting (POST) a new customer postal address

    Details: We extended the standard data entity ‘CustomerPostalAddressEntity’ to allow auto-generation of AddressLocationId field if not provided in the OData entity. And one more additional requirement to add ‘Telex Code’ in the address contact of type ‘Telex’. hence created a field called ‘STTelexCode’. The new entity name provided was “STCustomerPostalAddressEntity”. Command created in the scratch pad as follows. Bearer access_token is same as generated in step 1a above.

    POST https://<axbaseurl>/data/STCustomerPostalAddresses HTTP/1.1
    Authorization: Bearer eyJ0eXAiOiJKV1QiLCJJJJJJJJJJJJJJJJJJJJJJJJJTaW11RnJGTm9DMHNKWEdtdjEzbk5aY2VEYyIsImtpZCI6IkZTaW11RnJGTm9DMHNKWEdtdjEzbk5aY2VEYyJ9.eyJYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYnNhbmRib3guYXguZHluYW1pY3MuY29tIiwiaXNzIjoiaHR0cHM6Ly9zdHMud2luZG93cy5uZXQvMGJmM2Q3YWYtYzM4Ni00YTJiLTg3YjAtMTZlNzZhZGRmYjIzLyIsImlhdCI6MTUyMjMwMjg5NCwibmJmIjoxNTIyMzAyODk0LCJleHAiOjE1MjIzMDY3OTQsImFpbyI6IlkyTmdZSGgzNE1XUmczZG03N2x2MVB5aitpZG5IZ0E9IiwiYXBwaWQiOiJkOGY2M2NmYi01MDgxLTQ3MTMtYWMyZS02OGIzZDYzMjYxZDQiLCJhcHBpZGFjciI6IjEiLCJpZHAiOiJodHRwczovL3N0cy53aW5kb3dzLm5ldC8wYmYzZDdhZi1jMzg2LTRhMmItODdiMC0xNmU3NmFkZGZiMjMvIiwib2lkIjoiZDYwNzdkYzktNzczYS00MWE0LWFkNDAtMjBmZTI5MmMwNTFjIiwic3ViIjoiZDYwNzdkYzktNzczYS00MWE0LWFkNDAtMjBmZTI5MmMwNTFjIiwidGlkIjoiMGJmM2Q3YWYtYzM4Ni00YTJiLTg3YjAtMTZlNzZhZGRmYjIzIiwidXRpIjoiQ1hBWVZWMlpoMC0zTkZNM1M5TUpBQSIsInZlciI6IjEuMCJ9.pgf-hUFLhmadBVC8AXTmvP3IBROC-0tfF-qwYmdppkRbUj-xer-aPfB41Re41vtREOKAtMcmzQip7xtif7HnguDndh104hJZ9qHz-qp-zEQV4BCV-gb9pQw7LDvpwZNpGMGU6jrL2IYGdGTUcuhyNK2ePfInm5_TGpjiP_VKYUNcUZS-PUeGG6lqKL7oJlzlg6nTqbJJa3jXnCA0SbnSQwhyvgGVx97IGMqhQZ1MNNh3J5dHidL_8ubidwbP9FTjByC6rdtWsDWomJhDWe28zPbpS1CoClfvjewm1UII6j0PsPUc8hJwTjsZxmpfq__W9sZ5d7Be9TdqDlouof6vvg
    Content-Type: application/json; charset=utf-8
    Host: <axbaseurl>
    "CustomerAccountNumber": "Atul1012", 
    "CustomerLegalEntityId": "US01", 
    "AddressDescription": "hOME address1", 
    "dataAreaId": "US01", 
    "AddressCountryRegionId": "IND", 
    "AddressLocationRoles": "Delivery", 
    "AddressStreet":"Apurva Apartment complex,\n100 Block B, Apt 2011\n Near Ram Baazar",
    "AddressState": "IN.10", 
    "IsPostalAddress": "Yes", 
    "IsPrimary": "No", 
    "IsRoleBusiness": "No", 
    "IsRoleDelivery": "Yes",
    "STTelexCode": "ABCD123456" 

    Select above POST query (all lines) and click ‘Execute’ button. The result screen shown below with status code 201: Created.

    POST Created


    More to come using PATCH later.

    Happy Fiddling.


    Posted in Data Entity, Dynamics AX 365 for operations, OData Protocol, Uncategorized | Leave a comment

    D365 build warning on generate packages from VSTS

    I saw this error in the “generate packages” build step when running automated build process from VSTS. The build process completes with warning status as “partially succeeded”. There are many steps on the job, but warning generates at “Generate packages” step.
    Click on ‘Generate packages’ to see the log details:
    Here is the warning snippet:

    2018-03-14T23:04:51.7001491Z ##[section]Starting: Generate Packages
    2018-03-14T23:04:51.7005985Z ==============================================================================
    2018-03-14T23:04:51.7006123Z Task : PowerShell
    2018-03-14T23:04:51.7006240Z Description : Run a PowerShell script
    2018-03-14T23:04:51.7006341Z Version : 1.2.3
    2018-03-14T23:04:51.7006442Z Author : Microsoft Corporation
    2018-03-14T23:04:51.7006554Z Help : [More Information](https://go.microsoft.com/fwlink/?LinkID=613736)
    2018-03-14T23:04:51.7006693Z ==============================================================================
    2018-03-14T23:04:51.7035044Z ##[command]. 'C:\DynamicsSDK\GeneratePackage.ps1' -BuildPackagePath "C:\DynamicsSDK\VSOAgent\_work\1\Packages" -BuildBinPath "C:\DynamicsSDK\VSOAgent\_work\1\Bin" -BuildMetadataPath "C:\DynamicsSDK\VSOAgent\_work\1\s\Metadata" -BuildVersion "2018.3.14.2" -NoRuntime:([bool]0) -NoSource:([bool]0) -Verbose -ExclusionList "" -IncludeBinaries:([bool]1)
    2018-03-14T23:11:56.0455875Z VERBOSE: 11:11:56 PM: - Foundation Upgrade: Exporting model source...
    2018-03-14T23:11:56.0465237Z VERBOSE: 11:11:56 PM: - Command:
    2018-03-14T23:11:56.0465605Z K:\AosService\PackagesLocalDirectory\Bin\ModelUtil.exe -export
    2018-03-14T23:11:56.0465804Z -metadatastorepath="K:\AosService\PackagesLocalDirectory"
    2018-03-14T23:11:56.0465938Z -modelname="Foundation Upgrade"
    2018-03-14T23:11:56.0466101Z -outputpath="C:\DynamicsSDK\VSOAgent\_work\1\Packages\Source"
    2018-03-14T23:11:56.8326946Z VERBOSE: 11:11:56 PM: Model Foundation Upgrade was not found in the specified
    2018-03-14T23:11:56.8327660Z Metadata Store

    2018-03-14T23:11:56.8337750Z VERBOSE: 11:11:56 PM: - Foundation Upgrade: Model export completed with exit
    2018-03-14T23:11:56.8338146Z code: 1
    2018-03-14T23:11:56.8475192Z VERBOSE: 11:11:56 PM: - Exception thrown at
    2018-03-14T23:11:56.8475612Z C:\DynamicsSDK\GeneratePackage.ps1:216: throw "Error: Unexpected exit code from
    2018-03-14T23:11:56.8475830Z model export: $ModelUtilExitCode"
    2018-03-14T23:11:56.8476073Z System.Management.Automation.RuntimeException: Error: Unexpected exit code from
    2018-03-14T23:11:56.8476187Z model export: 1
    2018-03-14T23:11:56.9558677Z ##[error]Write-Message : 11:11:56 PM: Error generating deployable packages: Error:
    Unexpected exit code from model export: 1
    At C:\DynamicsSDK\GeneratePackage.ps1:523 char:5
    + Write-Message "Error generating deployable packages: $($_)" -Erro ...
    + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo : NotSpecified: (:) [Write-Error], WriteErrorExcep
    + FullyQualifiedErrorId : Microsoft.PowerShell.Commands.WriteErrorExceptio

    Specific error: ‘Foundation upgrade’ model was not found in the specified MetaData store. So the first step is to identify this ‘Foundation upgrade.xml’ file existence in AosService location (K:\AosService\PackagesLocalDirectory). I searched this file and found it is \ApplicationSuite\Descriptor file location.

    The problem exist in the “Foundation Upgrade” file. It seems that it is created by Microsoft in earlier days, and later they marked it ‘Disabled’ which you can find in the file that one element ‘Disabled’ is set to true. So during local compilation, metadata API process ignores the model where ‘Disabled’ element property is set to true. And because of this same property, model does not show up in the AOT as well. So when VSTS build tries to export this model, model utility (ModelUtil.exe) asks the metadata API for this model but it does not exist, hence this warning.

    Solution: The quick fix is to remove this ‘Foundation upgrade.xml’ file from VSTS Source control. And essentially, this file should not be checked-in into source control. Generally, when we get ISV code (for example, Avalara or SKG), they sometime provide this file in the package. And when we check-in the code into VSTS, we include this file ‘Foundation upgrade.xml’ as well. So special caution is required when you check-in the code received from ISV, ensure that this ‘Foundation upgrade.xml’ is not exist, and if exist, you should not check it in into source control.

    Happy building!!

    Environment: Dynamics 365 for finance and operations, release 7.2, update 12.

    Posted in Dynamics AX 365 for operations | Leave a comment

    D365 OData query calls: examples

    Working on Release 7.2, update 12 environments presently, recently I have been contacted by one of the client’s developer to query a specific customer record using OData.

    Online documentation is very limited, it explains about appropriate syntax but lacks examples. So this article talks about the examples:

    Example 1: Query one customer (DE-001) across one specific legal entity say ‘usmf’.

    Filter URL: https://D365URL/data/Customers?$filter=CustomerAccount%20eq%20%27Atul1012%27&dataAreaId%20eq%20%27us01%27

    In plain english, without encoding:

    https://D365 URL/data/Customers?$filter=CustomerAccount eq 'DE-001'&dataAreaId eq 'usmf'

    Example 2: Query a specific customer in ‘usmf’ legal entity:

    URL: https://mysite.cloudax.dynamics.com/data/Customers(dataAreaId='usmf',CustomerAccount='DE-001')

    Microsoft documentation exist: https://docs.microsoft.com/en-us/dynamics365/unified-operations/dev-itpro/data-entities/odata

    But in addressing section, to query a single entity from the entity collection, the URL is [Your organization’s root URL]/data/Customers(“[Key]”) but without any examples.

    Example 2 URL, for example, Customers data entity has just one primary key defined as ‘CustomerAccount’ but if you do not provide ‘dataAreaId’, it will not work. So ensure that ‘dataAreaId’ is provided.

    Example 3. CustomerPaymentJournalLineEntity, this entity has 2 keys: JournalBatchNumber and LineNumber. Once again there are 2 ways to access it. Either use $filter or inline query.

    Using $filter:


    Without encoding: /data/CustomerPaymentJournalLines?$filter=(JournalBatchNumber eq ‘00003’ and LineNumber eq 4)

    Using inline query:

    I get an error when I use this URL:



    No HTTP resource was found that matches the request URI 'https://mysite.cloudax.dynamics.com/data/CustomerPaymentJournalLines(JournalBatchNumber='00003',LineNumber=4)'. 
    No route data was found for this request.

    Resolution: Change the URL to add ‘dataAreaId’.

    So the new working URL is:


    That’s all for today!!


    Posted in Dynamics AX 365 for operations, OData Protocol, Uncategorized | 1 Comment

    D365: Workflow: Cannot start application

    Dynamics 365 for finance and operations (Previously known as AX 7) is getting very interesting day by day. New features and tools are released with every new updates.

    So I get a chance to work on workflows. D365FO has pretty interesting workflow designer that gets downloaded at runtime upon clicking on to a workflow. For example, Module Procurement and sourcing > Setup > Procurement and sourcing workflows. Assuming that workflow is already created in there, and assume the workflow name is “Purchase order workflow”. Now there is an error to this workflow. So as a developer, I click to it, and a run time application (of size about a little more than 7MB) gets downloaded to my machine, and  then workflow designer opens up. I fixed the issue, activated the new version after clicking ‘Save and close’. Pretty straight forward.

    Now I wanted to experience or do it in different environment (different Azure VM), the experience is little different, where I encounter this issue – A nice little popup: Title – “Cannot start application” and message “Application cannot be started. Contact application vendor.” Two buttons: OK and Details… Click “Details…” opens up a notebook file that explains lot of technical details about the issue, but error summary is “Unable to install this application because an application with the same identity is already installed. To install this application, either modify the manifest version for this application or uninstall the preexisting application.”.

    Error explains that applet (runtime application) already exist. Long story short, I figured that I can’t work on two workflows associated with two different URLs at the same time. So I investigated and found that these temporary files are stored in this location needs to be deleted manually before starting second workflow.

    1. Browse to location: C:\Users\<logged on username>\AppData\Local\Apps\2.0
    2. Here I saw 2 folders: Data and a folder with randon alphanumeric characters. In my case it was “KHGLL3L.ZBZ” (Jumbled characters).

    To ensure that I am deleting right set of files (and not deleting something that may cause me an issue later), I get into this folder “KHGLL3L.ZBZ” continued till I reached to “manifests” folder and did open a file of type “manifest” in notepad++.  Line number 5 – 8 had <entryPoint> information that explains that these needs to be deleted because these are associated with previous version of workflow I ran from another environment.

    <assemblyIdentity name=”Microsoft.Dynamics.AX.Framework.Workflow.WorkflowEditorHost” version=”″ publicKeyToken=”31BF3856AD364E35″ language=”neutral” processorArchitecture=”amd64″ />
    <commandLine file=”Microsoft.Dynamics.AX.Framework.Workflow.WorkflowEditorHost.exe” parameters=”” />

    Finally I deleted all the folders from step 1 (above) location [C:\Users\<logged on username>\AppData\Local\Apps\2.0] and it was Shift Hold + Delete button.

    Once all the files and folders deleted, I was able to start the workflow again from another Azure VM.

    Solution #2: (Provided by colleague)

    1. Press the windows key and In search box type ‘cmd’ to find a command prompt
    2. Right click on the command prompt and select run as administrator
    3. Copy the command below, paste the command into the command prompt, and hit enter.

    rundll32 dfshim CleanOnlineAppCache

    Additional Notes:

    1. Workflow applet works only in Internet Explorer.
    2. Add URL as ‘Safe URL’ so that applet (runtime application) should not identify it “unsafe” and download should initiate smoothly.
    3. I don’t need to delete folder content if I need to work on workflows only in one environment all the time. If I get this specific error, then only I delete the folder content.







    Posted in Dynamics AX 365 for operations, Uncategorized, Workflows | Leave a comment

    D365FO: Warning: This product cannot be sold to the customer due to the product filter settings for this customer

    During an integration process of a sales order line, my client received this error and integration failed. Actual error was –

    “code”:””,”message”:”An error has occurred.”,”innererror”:{
    “message”:”Write failed for table row of type ‘SalesOrderLineEntity’. Infolog: Warning: This product cannot be sold to the customer due to the product filter settings for this customer.; Warning: validateField failed on field ‘SalesOrderLineEntity.ItemNumber’.”,”type”:”Microsoft.Dynamics.Platform.Integration.Services.OData.AxODataWriteException”,”stacktrace”:”   at Microsoft.Dynamics.Platform.Integration.Services.OData.Update.UpdateProcessor.CreateEntity_Save(ChangeOperationContext context, ChangeInfo changeInfo)\r\n   at Microsoft.Dynamics.Platform.Integration.Services.OData.Update.UpdateManager.<>c__DisplayClass5_0.<CreateEntity>b__1(ChangeOperationContext context)\r\n   at Microsoft.Dynamics.Platform.Integration.Services.OData.Update.ChangeInfo.ExecuteActionsInCompanyContext(IEnumerable`1 actionList, ChangeOperationContext operationContext)\r\n   at Microsoft.Dynamics.Platform.Integration.Services.OData.Update.ChangeInfo.TrySave(ChangeOperationContext operationContext)\r\n   at Microsoft.Dynamics.Platform.Integration.Services.OData.Update.UpdateManager.SaveChanges()\r\n   at Microsoft.Dynamics.Platform.Integration.Services.OData.AxODataDelegatingHandler.<SaveChangesAsync>d__2.MoveNext()”

    If the Product filters are configured correctly then this integration would have worked, but simply enabling a flag would simply break the integration. And that’s what happened in this case.

    The flag was enabled (in the screen shot it is disabled because I did disable it).

    Product filters

    A relevant article I found online:


    And this article is further referring to AX 2012 R3 based article (pretty good information though)



    Posted in Dynamics AX 365 for operations, Uncategorized | Leave a comment

    D365FO: The menu item with name inventabcupdate could not be opened.

    In Dynamics 365 for operations, platform update 7, it was reported to me by my team member that they are getting following error upon running ABC Classification period task from Inventory management > Periodic tasks section.
    The menu item with name inventabcupdate could not be opened.
    Session ID:840b4e5c-1869-4180-953e-5a2d043ef9df
    Activity ID:bd183dd7-e5c1-4acb-90a2-3330cbbedf8f
    Search timestamp:2017-06-12T20:51:39.899Z

    Apparently, user interface screen is not showing a proper error message. Upon debugging, I found proper error in visual studio:
    Microsoft.Dynamics.Ax.Xpp.ErrorException was unhandled by user code
    Message: An exception of type 'Microsoft.Dynamics.Ax.Xpp.ErrorException' occurred in Dynamics.AX.ApplicationSuite.36.netmodule but was not handled in user code
    Additional information: ABC classification ABC classification Total value is 0.00 USD.

    Reproduction of the error

    I looked further into the classes, and found the details, basically the query that was running behind the scene. Based on the parameters defined in the ABC classification periodic task form, code runs the following query behind the scene (assuming from date value is ’06/01/2017′ and to date value is ’06/30/2017′), and ABC model value is ‘Revenue’.
    from InventTable A
    right join CustInvoiceTrans B
    on A.itemid = b.ITEMID
    where A.DATAAREAID = 'usmf' and a.ITEMTYPE 2
    and B.INVOICEDATE >= '06/01/2017' and B.INVOICEDATE <= '06/30/2017'

    This query will not result any record as I dont have any customer invoices exist in this date range.


    The only issue is that error/exception generated is not intuitive and is not presented nicely on the form. I will be working on it later.

    How to run this period task successfully?

    Well find out customer invoices data range, for example, when I run following query in SQL, I get lot of results. I provide this date range on the screen form, and it does run it correctly.
    from InventTable A
    right join CustInvoiceTrans B
    on A.itemid = b.ITEMID
    where A.DATAAREAID = 'usmf' and a.ITEMTYPE 2
    and B.INVOICEDATE >= '06/01/2014' and B.INVOICEDATE <= '06/30/2015'

    Once again, you can chose any value from ABC model drop down on the form. So above query update items: 4401, T0001 and so on.
    The values are appropriately updated in ‘Released Product’ > select a product > Manage costs (fast tab) > ABC classification (section).

    More technical details:

    On ABC Classification user form,

    • clicking of ‘OK’ button calls and execute inventabcupdate.xpp menu item class. execution starts with run() method.
    • it further calls InventABC.calc() method. InventABC.xpp class’s calc() method further calls sumUpValue() method. This method is implemented in the extended classes based on ‘ABC model’ selected. For example, there are extended classes for each modal. For example, InventABC_Revenue.xpp extends InventABC for ABCModel=Revenue, InventABC_InventValue.xpp extends InventABC for ABCModel=Value, InventABC_CarrCost.xpp extends InventABC for ABCModel=Link and finally, InventABC_ContributionMargin.xpp extends InventABC for ABCModel=Margin.

    All these extended classes run the make following query to check the list of items in the selected date range –
    {Query InventTable object 96a1ef50: SELECT FORUPDATE * FROM InventTable(InventTable) ORDER BY InventTable.ItemId ASC WHERE ((ItemId = N'D0004')) AND ((NOT (ItemType = 2))) OUTER JOIN * FROM CustInvoiceTrans(CustInvoiceTrans_1) ON InventTable.ItemId = CustInvoiceTrans.ItemId AND ((InvoiceDate>={ts '2017-06-01 00:00:00.000'} AND InvoiceDate<={ts '2017-06-09 00:00:00.000'}))}
    And then it can finally be converted into the following query:
    from InventTable A
    right join CustInvoiceTrans B
    on A.itemid = b.ITEMID
    where A.DATAAREAID = 'usmf' and a.ITEMTYPE 2
    and B.INVOICEDATE >= '06/01/2017' and B.INVOICEDATE <= '06/09/2017'

    By the way, above query will result to the error as I don’t have any invoices in this date range.

    I only explained about the mitigation actions here. Essentially, this error should be presented to user in more meaningful way so that user could take an action to fix the issue.



    Posted in Dynamics AX 365 for operations, Form exception, User Form | Leave a comment

    Entity Publishing Error in Dynamics 365 for Operations

    Dynamics 365 for Operations (formerly known as AX 7) has a feature of exporting data based on data entities on to Azure SQL Database for reporting purposes. It is very cool feature where there was a lot of demand from customers who would like to do data analysis using external reporting tools including (but not limited to) Power BI. Power BI can’t connect to cloud based AX databases so exporting data using data entities is a nice and cool feature.

    For publishing, it is required to enable the change tracking on Data Entities. This is first step. Second step is to publish the entity schema on to Azure SQL Database. This Azure SQL database subscription needs to be purchased separately.

    I was facing an issue where publishing of schema was failing because of following error:

    Could not load file or assembly ‘Microsoft.SqlServer.Smo, Version= Please note that this error appears on AX’s base version 7.1 onward. It means version prior to rename of ‘Dynamics 365 for Operations’ works fine with publishing.

    I had to open a Microsoft Ticket for this issue, and there is a hotfix available. It can be downloaded from here. Hotfix KB number is KB 3211228.

    As per Microsoft Support, the real issue exist in the Entity.Method as DMFEntityDbPublish.publishSchema() where a chain of DLLs reference to this Microsoft.SqlServer.smo.dll version which actually don’t exist in GAC or machine.

    Once this hotfix is applied, the problem goes away.


    Encounter the following error when publishing any entity

    Could not load file or assembly ‘Microsoft.SqlServer.Smo, Version, Culture=neutral, PublicKeyToken=89845dcd8080cc91’ or one of its dependencies. The system cannot find the file specified

    Cause: Known issue


    Patch KB3211228


    Posted in Data Entity, Dynamics AX 365 for operations | Tagged , , | 21 Comments