Prospect to cash integration – online documentation

Following my post earlier this year at tech conference 2017, more information regarding prospect to cash integration between Dynamics 365 for Sales and Dynamics 365 for Finance and Operations:

https://docs.microsoft.com/en-us/dynamics365/unified-operations/supply-chain/sales-marketing/prospect-to-cash

Cheers

Advertisements

Consuming Dynamics 365 for Finance and Operations OData services from .NET console application

After attending Tech Conference this year in Seattle, I decided to try consuming Dynamics 365 for Finance and Operations data entities through OData services from a .NET application (it is about time…). As you may know, this is replacing the old Dynamics AX 2012 AIF document services (AXDs).

I found few links on the Internet but it was not that straight forward to configure/implement so I thought I would just share the steps here 🙂

Azure app configuration

  1. Sign in to the Azure Portal with your O365 account which has access to D365 for Finance and Operations.
  2. Select Azure Active Directory icon on the left-hand side and App registrations then click New application registration.
  3. Enter your app name, select application type Native, enter your organization’s URL in Redirect URI (e.g. https://demoXXXaos.cloudax.dynamics.com) and then click Create.
  4. In Search by name or AppId field, enter your app name (or part of it) so it is filtering the list of apps and select it from the list.
  5. Now let’s create a new key for the registered app. Enter a Key description, Duration and click Save. It will automatically generate a key value that you will need to save so that we can use it later in the Visual Studio project. Also save the Application ID for later.
  6. Next you will need to add required permissions for Dynamics 365 for Financials.
  7. Tick the Access as the signed-in user delegated permission and click Select.
  8. Verify that you can see the Dynamics 365 for Financials delegated permission.

D365 for Finance and Operations configuration

  1. Open your Dynamics 365 for Finance and Operations in your preferred web browser.
  2. In System administration > Setup > Azure Active Directory applications, click the New button to create a new record.
  3. Enter your Azure Application Id into the Client Id field.
  4. Enter your Azure Application name into the name field.
  5. Select Admin in User ID field.
  6. Click the Save button.

OData client configuration

  1. Download the codebase from Microsoft in GitHub here.
  2. Start a new instance of Visual Studio 2015 and open the ServiceSamples solution.
  3. As suggested in the first link in References, I could not update the MetadataDocumentUri variable in ODataClient.tt file and save it to re-generate the ODataClient.cs.
  4. Instead I had to delete the ODataClient.tt and ODataClient.ttinclude and re-create the OData client.
  5. Right click on ODataUtility project > Add > New item, search for ‘OData’ in Online and rename it to ODataClient.tt (if you already installed it will appear under Installed on the left-hand side).
  6. In Solution Explorer, open ODataClient.tt file that you just added and update the MetadataDocumentUri variable to “/data/” where is your organization’s URL, for example “https://demoXXXaos.cloudax.dynamics.com/data/”.
  7. Then save it to generate the proxy classes (might take a few min).
  8. You should be able to see proxy classes in the ODataClient.cs.

Client configuration

  1. Still in the the ServiceSamples solution in Visual Studio 2015, open the ClientConfiguration.cs under the AuthenticationUtility project.
  2. Update all variables under OneBox:
    1. UriString with your organization’s URL
    2. Username with you O365 account with access to Dynamics 365 for Finance and Operations
    3. Password with your password
    4. ActiveDirectoryTenant, same as your organization’s URL without the “/” at the end
    5. ActiveDirectoryTenant with your tenant Id
    6. ActiveDirectoryClientAppId with your Azure application Id
    7. ActiveDirectoryClientAppSecret with you Azure key value
  3. Save your changes.

Running the ODataConsoleApplication with simple CRUD operations for asset major types

  1. Select ODataConsoleApplication project in Solution Explorer, Right click > Set as Startup Project.
  2. Open the Program.cs file under ODataConsoleApplication
  3. Comment all lines except SimpleCRUDExamples.SimpleCRUD(context).
  4. Add 3 breakpoints in SimpleCRUDExamples() method for d365.SaveChanges() lines 23, 34 and 43.
  5. Run the code and on first breakpoint have a look in Dynamics 365 for Finance and Operations Fixed assets > Setup > Fixed asset attributes > Major types and check Test01 is not created yet.
  6. Then back in Visual Studio, press F10 to step over and refresh your browser, you can now see new Test01 major type is created.
  7. Back in back in Visual Studio again, press F5 to go to the next breakpoint and then F10 to step over (almost there!!!).
  8. Check asset major types and description field is now updated from Description of Test01 to Updated description.
  9. Press F5 twice to finish the execution, asset major type Test01 is deleted.
  10. Review the console output.

Conclusion

In summary, I have explained how to configure and consume simple CRUD operations for the asset major type data entity using OData services and .NET application. Obviously we used the asset major type as an example but you can use any standard data entity or even your custom data entity as long as isPublic property is set to Yes.

I did not cover the OData query options or save changes options which are quite powerful. In addition, feel free to have a look at the other projects for JSON, SOAP and tests, I am sure they are worth a try.

I hope you will find this post helpful and I look forward to any feedback or question you may have.

Also it would be interesting to compare data entities features with the AX2012 AIF document services. For example, what are the equivalent of prepareForSave(), processingRecord()… methods? How do you implement external codes for items, customers… as it was previously configuration only in AX2012? How to trigger a packing slip posting after importing multiple lines?

References:

  1. Consume the OData API from an external console application
  2. OData services endpoint
  3. Register a native application with AAD
  4. Microsoft Dynamics AX Integration: A Customer Perspective (if you have access to Microsoft Dynamics Learning Portal)

Dynamics 365 for Operations – Spring 2017 Release

I was lucky enough to attend Dynamics 365 Tech Conference couple of weeks ago and there were some really exciting announcements for the Spring Release during the opening key note from Sri Srinivasan:

  • On premises for Q2 CY 2017 and hybrid (cloud + edge) deployment options for H2 CY 2017,
  • Data upgrade process for AX2012 to Dynamics 365 for Operations,
  • Dynamics 365 for Sales and Operations Prospect-to-Cash integration,
  • Big focus on application extensions as core models to be hard sealed by Fall Release 2017/Spring Release 2018,
  • Dynamics 365 Integration Platform leveraging Common Data Services (CDS),
  • Embedded PowerBI dashboards within Dynamics 365 for Operations web client

Stay tuned, more to come…

Cheers