tracking code
LBMC Technology Solutions
  • Home
  • Solutions
    • Dynamics 365
    • Dynamics NAV
    • Dynamics GP
    • Dynamics CRM
    • Sage Intacct
    • Document Management (ECM)
    • Network Engineering and IT Solutions >
      • IT Security
      • Managed IT
      • Business Phone Systems
  • Events
    • All Upcoming Events
    • Training / CPE
    • Webinars and Workshops
  • Resources
    • Blog
    • Forum
    • On-Demand Webinars
    • Referral Program
    • Services We Offer
    • Support
  • About Us
    • Careers
    • Partner with Us
    • Community
    • Contact Us

Use the Dynamics 365 for Financials OData Service

11/11/2016

0 Comments

 
Posted by Paul Haag

As you may or may not know, Dynamics 365 for Financials (we’ll just call it Financials as a shorthand for this post) is based on Dynamics NAV, so, although they may diverge eventually, most of the concepts of connecting to Dynamics NAV work right out of the box.

In this post, we’re going to take a look at the steps necessary to service-enable the Sales Invoice page and then start creating invoices in a simple command.
Picture

Enable the Sales Invoice Web Service

In the NAV / Financials world, you have to one-off enable queries or pages for connectivity through web services.
  1. Navigate to the Web Services page (you can just search for it). You will already see a list of existing Query web services (these are used by the Power BI dashboard integration).
  2. Click New and enter:
    a.  Object Type: Page
    b.  Object ID: search for Sales Invoice.
    c.  Service Name: SalesInvoices (or similar)
    d.  Mark Published.
  3. After you save it, the URLs will be populated. In my case, I couldn’t scroll to the right to see all of them, but you can hover over any of the column headers and select Choose Columns to narrow it down.
  4. Copy the OData URL (not the OData V4 URL) since Visual Studio’s Add Service Reference doesn’t work with V4 yet.

Figure Out your Credentials

When connecting to the Financials' web services, you use a different username and password than when you log in.
  1. Navigate to the Users page.
  2. Select your user in the List and click Edit in the ribbon.
  3. Note the value in your User Name field. That’s your user name for the web services.
  4. In the ribbon header, click the Change Web Service Key button.
  5. Either enter a date when the password will expire or mark that it never expires and click Done.
  6. If it didn’t automatically, expand the Web Service Access area (by clicking on the header) and copy the Web Service Access Key.

Create Invoices!

Now we'll use Visual Studio's native OData client functionality to connect to the web service and create an invoice. I'm using Visual Studio 2015.
  1. Create a new Console Application project.
  2. Right-click References and choose Add Service Reference.
  3. For the address, use everything up until the OData part of your URL. For example, https://mycompany.financials.dynamics.com:7048/MS/OData
  4. Visual Studio will prompt you for credentials, so enter the User Name and Web Service Access Key you got earlier.
  5. It should find a Service called NAV (I told you it was based on Dynamics NAV).
  6. Change the Namespace to whatever you want or leave it as ServiceReference1 and click OK.
  7. Copy and paste the following code block (be sure to replace the URL and credentials with the correct values):
code block
Click to enlarge

There are a couple of notes with this:
  • The relationships between records (i.e. between the invoice and the customer) are through the Name fields, but you can specify the key values. Above, I have specified Customer No. 20000 for the Sell_to_Customer_Name.
  • The Financials web services automatically expose some related collections (i.e. line items for an invoice). You add to those by using the AddRelatedObject method and specifying the “Navigation Property” name.
  • To see the metadata for all of the web services (and things like Navigation Properties), add /$metadata to the OData URL you specified when adding the service reference in Visual Studio.
  • Note that your company name is appended to the URL to integrate to a specific company. I’m not 100% sure if that can ever be different than what you see in the Business Manager when you log in, but that is what it was for me (URL encode, of course).

Other Tools

Of course, I showed using this with Visual Studio, but these web services are OData- (and OData V4-) compliant, so there are a number of other tools that would work out there. eOne Solutions already has a NAV connector and I’ve been told they’ll be adding a connector specifically for Financials shortly.

If you have any questions feel free to
contact us.

Picture
0 Comments

Your comment will be posted after it is approved.


Leave a Reply.


    Blog

    ​Your one stop shop for technology.

    Categories

    All
    Business Central
    Dynamics 365
    Dynamics CRM
    Dynamics GP
    Dynamics NAV
    Events
    Microsoft Dynamics Add-ons
    Software Decisions
    Tutorial

Solutions
Microsoft Dynamics 365
    Business Central
    Customer Engagement
Microsoft Dynamics NAV
Microsoft Dynamics GP
​Microsoft Dynamics CRM
​Sage Intacct
​
Network Engineering

​ERP Comparison Guide
Learning Opportunities
All Upcoming Events
User Conferences
Training / CPE
Vision
Webinars & Workshops
​

Resources
Blog
Forum
Referral Program
​​YouTube Channel

Company
About Us
Careers
Contact Us
​
Locations
Charlotte
Knoxville
Nashville
Picture
Picture
Proudly powered by Weebly

Sitemap | Home | Careers | Contact Us

share

Copyright © 2019

LBMC Technology Solutions