Wednesday, October 29, 2014

Microsoft Dynamics GP 2015 Developer's Preview: .NET Framework Interoperability - Part 3

In part 2 of the series, I delivered a brief primer on the service architecture in Microsoft Dynamics GP 2015 and how you are able to consume services natively created with Dexterity. There are two types of services that can be created: services that wrap existing windows and forms functionality, i.e., creating a customer; and services that can wrap around existing sanScript procedures, i.e, retrieving customer information. The truth is, none of that stuff would be possible without the ability to interoperate with the Microsoft .NET Framework.

Today, I'm going to show you some of the .NET interop capabilities built into Dexterity 14.0 and how these can enhance the user experience and your application integration capabilities. The example used in this post is based on my previous article, Building a COM Interop Assembly to use with Microsoft Dexterity, which showed how we had to leverage .NET's ability to expose an assembly via COM interfaces, so we could reference its methods using Dexterity. In that particular example, I built some standard methods to expose the sine, cosine, and tangent trigonometric functions to a Dexterity application. This time around, I will show how to build the same functionality taking full advantage of Dexterity's new .NET interop capabilities.

The user experience will be slightly different this time. In addition to a window that will allow you to calculate any of the trigonometric functions on a specific angle (entered in degrees), we will display a .NET form showing a visual representation of that angle. The .NET form will be dynamically built and displayed from Dexterity using the methods and properties provided by the Form class (System.Windows.Forms) and the visual drawings will be delivered using the classes exposed in the System.Drawing namespace.

1. The first things we must do is incorporate references to the corresponding assemblies for the Forms class and Drawing namespaces. As developer, the first thing you will notice is the enhancements to Dexterity's Library Definition window, which now allows for the selection of a .NET Assembly library type.

Library Definition
Once the type has been selected, you can browse out to the different .NET assemblies loaded on your operating system.

.NET Assemblies
In particular, what I like is the ability to select the .NET Framework assembly that I want to work with directly, as opposed to having to compile my application for a specific Framework version as you normally would do with Visual Studio.

Resource Explorer will now reflect the different .NET namespaces selected for you application.

Resource Explorer

2. Since this article assumes some familiarity with Dexterity, I'm not going to dive into the process of building the form and window, but rather point out that it follows the same layout and properties I used in my previous article.

Form and Window Definition
The only "rarity" here is I added a local field called '(L) GraphicAngleForm' that will serve as a generic reference to the .NET form we will dynamically create. The '(L) Conversion' and '(L) Angle' fields are currency fields and are formatted with two decimals and unsigned (DLR11_U2).

Generic Reference field

3. The code for our '(L) Sine' button will look something like this.

MGB_Trigonometric_Test l_Sine_CHG
// Created by Mariano Gomez, MVP
//  This code is licensed under the Creative Commons 
//  Attribution-NonCommercial-ShareAlike 3.5 Generic license.
using System;
using System.Windows.Forms;
using System.Drawing;

local currency l_angle;
local Form f;

'(L) Prompt' = "The Sin(%1°) value is ";
substitute '(L) Prompt', str('(L) Angle');

// calculate the sine value of the angle after converting it to radians
'(L) Conversion' = Math.Sin(Math.PI * '(L) Angle' / 180.0);

if empty('(L) GraphicAngleForm') then
 f = new Form();
 '(L) GraphicAngleForm' = f;

 f.Text = "Graphical Representation of the Angle entered";
 f.BackColor = Color.White;
 
 // Set the size of the form
 f.ClientSize = new Size(640, 480);
 
 // Make the form a fixed size
 f.MaximumSize = f.ClientSize;
 f.MinimumSize = f.ClientSize;
 
 // event handlers
 f.Paint += PaintAngle of form MGB_Trigonometric_Test;
 f.FormClosed += CloseDrawingForm of form MGB_Trigonometric_Test;
 
end if;

// show and activate our .NET form
'(L) GraphicAngleForm'.Show();
'(L) GraphicAngleForm'.Activate();

When you really look at the code, the first thing you will notice is the first 3 lines. sanScript now implements the using statement just like C#. sanScript has also been extended to use the implement statement for dynamically referencing an assembly.

using System;
using System.Windows.Forms;
using System.Drawing;


Next we can then calculate the sine of the angle in radians by simply calling the Math.Sin() method in the System namespace (the System namespace is part of the Microsoft Core Library, mscorlib.dll). We also reference the Math.PI constant to perform the conversion of the angle from degrees to radians.

// calculate the sine value of the angle after converting it to radians
'(L) Conversion' = Math.Sin(Math.PI * '(L) Angle' / 180.0);


Once we have the angle converted and displayed in the '(L) Conversion' field, we can proceed to create the form by instantiating the Form class - in reality, this part is no different than what you would normally do for COM classes - and setting some properties for the .NET form we want to display. Once we have set the size of the window, we need to create some event handlers for when the .NET form open and closes. As you can see in the code, Dexterity now implements event handlers through the use of the += operator.

// event handlers
f.Paint += PaintAngle of form MGB_Trigonometric_Test;
f.FormClosed += CloseDrawingForm of form MGB_Trigonometric_Test;


Our event handlers in this case will be the PaintAngle (on .NET form open) and CloseDrawingForm (on .NET form close). The PaintAngle event handler will display the actual graphical representation of the angle, and the CloseDrawingForm event handler will do some cleanup for us. Now, as you may suspect, these event handlers are implemented as procedure scripts to the MGB_Trigonometric_Test form (form procedures). So let's take a look at the PaintAngle form procedure:

PrintAngle
// Created by Mariano Gomez, MVP
//  This code is licensed under the Creative Commons 
//  Attribution-NonCommercial-ShareAlike 3.5 Generic license.
using System;
using System.Windows.Forms;
using System.Drawing;

inout System.Object sender;
inout PaintEventArgs e;

local Pen bp, rp;
local Color c;

// Get the color
c = Color.Blue;

// Create the blue pen
bp = new Pen(c, 2);

e.Graphics.DrawLine(bp, 320, 240, 520, 240);
e.Graphics.DrawLine(bp, 320, 240, 320 + Math.Cos('(L) Conversion' of window MGB_Trigonometric_Test) * 200, 240 
 - Math.Sin('(L) Conversion' of window MGB_Trigonometric_Test) * 200);

c = Color.Red;
rp = new Pen(c, 2);

e.Graphics.DrawEllipse(rp, 300, 220, 40, 40);

Again, the mechanics here is not so much the important part, but rather to highlight the clever way in which the event handler parameters are declared for the sender of the event and the event arguments being passed by the sender of the event. For this the Dexterity team chose to implement inout parameters.

Overall the PrintAngle procedure simply draws two lines and a circle. The first line is the base line of the angle and will simply be a horizontal line. The second line actually shows the displacement in reference to the base line to give the actual angle representation. This all looks something like this when the code is executed:

Angle Calculator
Having the ability to leverage .NET capabilities directly from Dexterity has now opened up a new realm of possibilities for Microsoft Dynamics GP business application developers. Applications that were once thought to be out of reach or required complex workarounds are now a thing of the past. Code portability is now much more compact and robust than before. The good part is, Dexterity developers do not need relearn any development patterns and/or be exposed to steep learning curves. All the .NET Framework documentation is available online with tons of sample code to go along.



This article is part of the Microsoft Dynamics GP 2015 Developer's Preview series.

Microsoft Dynamics GP 2015 Developer's Preview: Loading the VHD image - Part 1
Microsoft Dynamics GP 2015 Developer's Preview: Working with Sample URIs - Part 2

Until next post!

MG.-
Mariano Gomez, MVP
Intelligent Partnerships, LLC
http://www.intelligentpartnerships.com/

Tuesday, October 21, 2014

GPUG Summit 2014 St. Louis - Wrap Up!


Wrap Up Post

It's time to close this chapter, but not without a few thoughts:

1. The Summit keeps attracting more and more attendees each and every year. This year, we maxed out at around 3,500 people which is quite a feat if you put it in perspective. My gut feeling tells me in a couple years we will be talking Convergence numbers and this will be mostly end-users!

2. I feel the Summit could take advantage of repeat sessions, similar to Convergence. Many topics were too similar in title and content, which could confuse the end-user when selecting a session to attend, given that each presenter (and presenter style) is different.

3. There aren't enough parties! Rock-n-Rave and FastPath alone cannot entertain 3,500 people -- on another note, after seeing Andy Snook rock the bass at the PBR St. Louis, I'm convinced that we could take advantage of a stadium or arena to make something big.

4. It's cool to hang out with Polino. They guy simply knows when to relax and have fun! I wish he rode the bull at PBR. That would have been quite the show.

Coverage from the previous days can be found using the links below:

GPUG Summit 2014 St. Louis - Day 3
GPUG Summit 2014 St. Louis - Day 2
GPUG Summit 2014 St. Louis - Day 1
GPUG Summit 2014 St. Louis - Academy Training
Partner Connections 2014 Kicked Off a Great Summit
GPUG Summit 2014 St. Louis - The Journey Begins


Downloads

You can download the presentation materials for my sessions (including the session I did with Kitty Geiger on Modifier with VBA) from OneDrive using the following link:

http://1drv.ms/1rbF97W

See you in Fargo, North Dakota in November for reIMAGINE 2014. I will co-presenting with Kevin Racer on some GP 2015 Service Based Architecture stuff and with David Musgrave on the Support Debugging Tool. You will not want to miss any of this action.

Until next post!

MG.-
Mariano Gomez, MVP
Intelligent Partnerships, LLC
http://www.intelligentpartnerships.com/

GPUG Summit 2014 St. Louis - Day 3


Friday, October 17, 2014

Ok, what just happened last night, ugh! Day 2 was quite the day (and the night!). However, the Summit was coming to an end and it was almost time to close the curtains on what I personally reckon to be a very successful event. This meant participating in the last networking huddle event, which had tables organized by roles; visit the Expo one last time to say bye to ISVs who tirelessly worked to bring some of the best products to market; and attend maybe a session or two going throughout the day.

After the networking huddle, it was time for the Ask the All Stars session which, as its now traditional, is preceded by the GPUG All Star nomination and award. I have to say that this year I was fortunate enough to have been nominated, but felt short by one vote... just messing!

GPUG All Stars, Shawn Dorward, Belinda Allen, and Aaron Back
The new All Stars mingled with the previous year crop to take questions from the audience in attendance at the Ferrara theater, MCed by Andy Hafer. Upon conclusion of the Q&A session, it was time to honor the very first recipient of the Richard Whaley Academy Award with the distinction going to Mr. Bob McAdam. Bob has tirelessly worked to provide some of the best end-user Academy classroom training content out there and in doing so, has been recognized by community users as a consummate professional. As you may know, Richard left us all last month after years dealing with personal ailments.

To award was handed to Bob by Richard's daughter Elizabeth "Betsy" Whaley with Rich Beliveau, Academy Director MCing the ceremony.

Bob McAdam receives Richard Whaley Academy Award
Of course, no Summit would be complete without knowing where the next event will take place, so it was announced that Reno-Tahoe, NV will be the destination of the next GPUG Summit 2015 event. The following video shows what awaits next year's Summit attendees.




Until next post!

MG.-
Mariano Gomez, MVP
Intelligent Partnerships, LLC
http://www.intelligentpartnerships.com/

GPUG Summit 2014 St. Louis - Day 2


Thursday, October 16, 2014

With Day 1 behind us, Day 2 brought a lot of expectations as it was officially a full day of sessions. Yes, that meant a lot more sessions than even the day before. My day started out with Mariano's Toolbox Series: The Support Debugging Tool at 9:45 AM. I have to say that I was pleasantly surprised to have over 60 people in this session, given the night before was Rock-n-Rave. The cool thing is, I just had two or 3 people who had been to the party.

After my session, I met up with a few folks over at the Mekorma Hub to discuss how their sessions were progressing. Then, we head down to the Meal Hall for lunch and to participate in the networking huddles.

Networking Huddles
My afternoon session, Mariano's Toolbox Series: Upgrading to Microsoft Dynamics GP 2013 at 2:00 PM was also received well with over 40 people in attendance. However, these Summit events are all about the spirit of the community. My good friend Kitty Geiger (myappsanywhere.com) was in a pinch to get one of her Modifier with VBA examples for her session working, so we sat down at the Mekorma Hub to take a look at it. Given the complexity of what she was trying to achieve and the little time we had, we decided to download and use the sample VBA customization found on my Modifier with VBA Workshop series.

In the end, Kitty and I ended up both delivering her session, TechExpert: Leverage the Advantage of Modifier with VBA. This completed a day of 3 full sessions, so it was time to get some drinks and enjoy the rest of the evening.

I went to my hotel to drop off my stuff and met up with friends over at Copia Restaurant & Wine Garden for a wine tasting event hosted by Scribe Software. After wrapping up, we went over to PBR Cowboy Bar to tap off the evening with the FastPath team who was hosting a party to celebrate Andy Snook's birthday and in addition to simply, well, drink!

PBR St. Louis


Andy Snook at the Bass

I must say, I was quite surprised to learn that Andy Snook not only talks security, but also rocks the bass. The night went on and the drinks kept coming. However, I had a chance to catch up with a whole bunch of folks that you keep seeing at the same parties.

From left to right:
 Denis Day (DLD Business Solutions), Helen Samworth(m-hance USA), Chris Dew (eOne Business Solutions), Tanya Henderson (S2 Technology), Mark Polino (Integrated Business Group)

In this picture, the orange glasses came courtesy of Darcy Boerio, Channel Development Manager at Avalara.

MVPs Mariano Gomez and Mark Polino

Then there was the unspeakable. So it's best I leave it at that. It was past 2:30 AM when I left so I can only assume things continued throughout the morning for a few souls.

Until next post!

MG.-
Mariano Gomez, MVP
Intelligent Partnerships, LLC
http://www.intelligentpartnerships.com/

GPUG Summit 2014 St. Louis - Day 1


Wednesday, October 15, 2014

After a jammed pack Academy Training day on the previous day, Summit Day 1 begins with a little stroll from my hotel down to the America's Center Convention Complex. On the way there, I cannot help but to snap a picture of the now very famous Runner Fountain at Kiener Plaza, which happened to be running a pink to red tone in support of the Cardinals.

The Runner Fountain at Kiener Plaza (in front of Jefferson National Expansion Memorial)
This is probably one of the most sought after shots for any photographer (which I'm not!), so why not.

The Runner Fountain in front of historic Old Court House and Gateway Arch
At the Convention Complex, the day opened with the keynote session where Andy Hafer and Hal Howard provided some great input into the growth of the Summit event over the years. Andy also welcomed the more than 47% of first time attendees to Summit and jumped into some of the key stats that made this the largest summit in the 10 years running.

Keynote Speech with Andy Hafer

Keynote with Andy Hafer and Hal Howard (Summit by the numbers)

It was time to turn the tides and on came funny man, motivational speaker, and self-proclaimed "attitude adjuster"Steve Rizzo, who started the day with a very cool outlook into his early childhood and key learnings from his career as a comedian. The highlight: "Feeling good is the fuel that drives motivation." Steve proposed achieving this by simply changing our early morning attitude. Focusing on the good things in life - as opposed to the non-essential and non-consequential - by getting "your shift together" makes all the difference.

Steve Rizzo
After the keynote, it was time for my first session of the Summit: Mariano's Toolbox Series: Integration Manager. This year, Kim thought it would be great to have a branded list of sessions that allowed me to showcase a few of my tips, tricks, and best practices around Microsoft Dynamics GP so, I went along!

Attendees to Mariano's Toolbox Series: Integration Manager session

My session had well over 50 attendees and showcased some of the key aspects of working with Integration Manager and how scripting can expand the out of the box capabilities - well, I believe I lost a few people here, but I think the audience was satisfied with the overall presentation.

Once my session concluded, I went over to the Ferrara Auditorium to attend the GPUG Summit General Session, MCed by Kim Peterson,

GPUG General Session
Kim welcomed premier sponsors Fastpath, Metaviewer, and Rockton Software on stage to ask them about their products and the value to the community. As is customary, Mark Rockwell certainly brought down the house with one of his now very popular product jingles.

Premier Sponsors: Fastpath, Metaviwer, and Rockton Software on stage
Then it was Microsoft's turn to showcase some of the upcoming features, roadmap, and vision surrounding the upcoming releases of Dynamics GP. Errol Schoenfish, Director of Product Management and Jeff Trossen, VP of Product Development presented some of the great features that will be released in the upcoming Microsoft Dynamics GP 2015, including but not limited to, extended workflow capabilities, the new service based architecture components, Business Analyzer for Android and iOS, and some of the employee self-serve capabilities. For more information on the upcoming GP 2015 features, take a look at the Inside Microsoft Dynamics GP blog.

Microsoft Dynamics GP Vision

After the General Session, it was time for my second session of the day: Mariano's Toolbox Series: Web Client Deployment. Again, this session was a real treat to those in attendance as only a couple of hands went up when asked if they had seen or work with the Dynamics GP web client. We got a chance to look at all the components, some technical implementation aspects, and definitely all related to infrastructure on premise and in the cloud.

Following my session, it was time to head back to the Expo and comingle with the ISV community.

2nd Day of Expo

By now, you are familiar with Rock-n-Rave at Summits and Convergence and this time it was no different. The venue: the Lucky's Dueling Piano Bar. However, still too much for me to go through so off I went to my hotel for a quiet night.

Until next post!

MG.-
Mariano Gomez, MVP
Intelligent Partnerships, LLC
http://www.intelligentpartnerships.com/

Monday, October 20, 2014

GPUG Summit 2014 St. Louis - Academy Training


Tuesday, October 14, 2014

After a successful Partner Connections event, Tuesday brought and "All you can digest" Academy Training day, with 100s of sessions across all products. Unlike at the Tampa Summit, this year I did not participate as a trainer and rather decided to spend most of the morning catching up on work and prepping for my first session on Wednesday.

In the afternoon, I attended a presenters prep round up meeting at 4:00 PM local time, carried out at the Mekorma Hub. GPUG Director, Kim Peterson welcomed all new presenters and provided last minute instructions to the group.

Presenters Prep Round Up meeting with Kim Peterson

After the meeting, it was time to visit the Expo which would be opening its doors for the first time. I have to say, I was pretty impressed by the final product, since just a day before, the place was still being, literally, put together. It's amazing that 100s of ISVs and sponsors were present, displaying their products and welcoming all attendees.

Dynamic Communities team welcoming everyone at the Expo

The food was great and nothing better than free booze to go along. After navigating the isles and saying hi to a number of ISVs, it was time for me to head back to my hotel. After all, I had a couple of support tickets to take care of and needed to fine tune my presentations for the days to come.

Jefferson National Expansion Memorial

On the way back to the Hilton at The Ballpark, I managed to snap this cool picture of the Jefferson National Expansion Memorial building, a part of the National Park Service.

Until next post!

MG.-
Mariano Gomez, MVP
Intelligent Partnerships, LLC
http://www.intelligentpartnerships.com/

Partner Connections 2014 Kicked Off a Great Summit


Monday, October 13, 2014

Summit is now gone, but I wanted to take some time to recount some of the events as I saw them happening. First, I wanted to congratulate the Dynamic Partner Connections team for an excellent event hosted at the Renaissance Hotel. The location could not be anymore upscale and clearly was a great way to get things started.

As I was strolling along the corridors of the hotel with MVPs Joris de Gruyter and John Lowther, we ran into some of the awesome Dynamic Communities folks.

From left to right: Michelle Spitzer, Mark Rhodes, Joris de Gruyter, John Lowther, and Liz Hallen
Most of the topics at the Partner Connections day revolved around leadership and various NAV and SL topics - since the Summit itself tends to be dominated by AX, GP, and CRM, I guess this was a good thing.

Midday came along and it was time for Q&A with Hal Howard, former Microsoft executive and new Executive Director of Dynamics Communities. Many questions coming from the partner community revolved around Microsoft's dismissal of the certification requirements for Dynamics GP, Dynamics SL, and Dynamics NAV and whether Microsoft was trying to send a stronger message with such move. For example, a question came in related to Microsoft "killing the products" via a sale to a competitor or simply a code rollup into one product, a reminder of the Project Green days.

Andy Hafer and Hal Howard field questions from the audience

After the Q&A session, it was time for welcoming Hal to Community and a quick pic.

John Lowther, Hal Howard, Mariano Gomez, Joris de Gruyter

After lunch, I decided to stop by the Expo hall to see how things were progressing and I have to say that, no matter which venue is chosen, it never ceases to amaze me the amount of work that goes into conditioning a massive room with booths, banners, and lighting.

Expo Hall

The same could be said for the Meal hall which, this time around, had to be able to accommodate 3,500 people at any given time.

Meal Hall  - Andy receiving final updates
Came the evening, it was time for the partner reception. I had a chance to catch up with a number of partners and ISVs in attendance and really enjoyed the atmosphere of camaraderie and pleasantries around good food and drinks.

MVPs John Lowther and Leslie Vail

Team Altec (www.altec-inc.com

Frank Vukovits (Dynamic Communities) and Jon Rivers (Data Masons)

After Partner Connections and the partner reception, it was time to gracefully go back to my hotel room and catch up on some work.

Until next post!

MG.-
Mariano Gomez, MVP
Intelligent Partnerships, LLC
http://www.intelligentpartnerships.com/

Sunday, October 12, 2014

GPUG Summit 2014 St. Louis - The Journey Begins



My journey to St. Louis, MO begins today. As it's customary, I will be writing articles on a daily basis, if possible, to narrate the events of the day. I have a busy schedule, with presentations on Wednesday, Thursday, and Friday (I just took on a new session on Friday at 2:15 PM called "Testing, Testing, & More Testing" related to upgrades). Please follow me on Twitter @dgpblogster, or The Dynamics GP Blogster on Facebook, and of course right here on this blog for more info on the event and those little behind the scene moments. This year, the Summit is expecting a record breaking 900 attendees and is growing to be THE EVENT to attend after Convergence. If you have not signed up to be a GPUG member, what are you waiting on?
Until next post!

MG.-
Mariano Gomez, MVP
Intelligent Partnerships, LLC
http://www.intelligentpartnerships.com/

Wednesday, September 24, 2014

Microsoft Dynamics GP 2015 Developer's Preview: Working with Sample URIs - Part 2

In the part 1 video, I explained how to mount the Microsoft Dynamics GP 2015 Developer's Preview virtual hard disk using Hyper-V. My intent was to provide a part two showing how to mount the VHD file on Windows Azure, but realized it would take more time than I wanted to invest in really getting the point across on many of the aspects around the new service architecture components, so I have decided to forgo the Azure portion until some other day.

Today, I will focus on some of the sample service requests provided on the Developer's preview image, which can be found in the Example Service Requests.txt file available on the desktop of the image.

Before however, I wanted to touch base on REpresentational State Transfer (REST) services. REST, a term first coined by Roy Fielding (a principle author of the HTTP specification) in his doctoral dissertation, is an architectural style that treats networked application states and functionality as resources, which share a uniform interface. This architectural style differs in many ways from that of the Remote Procedure Call (RPC) architecture where services reside on the network and are invoked using request parameters and control data contained within messages.

Some of the basic principles governing REST services are:

  • Actors interact with resources, and resources are anything that can be named and represented. Each resource can be addressed via a unique Uniform Resource Identifier (URI).
  • Interaction with resources (located through their unique URIs) is accomplished using a uniform interface of the HTTP standard verbs (GET, POST, PUT, and DELETE). Also important in the interaction is the declaration of the resource's media type, which is designated using the HTTP Content-Type header. (XHTML, XML, JPG, PNG, and JSON are some well-known media types.)
  • Resources are self-descriptive. All the information necessary to process a request on a resource is contained inside the request itself (which allows services to be stateless).
  • Resources contain links to other resources (hyper-media).

While REST is defined by its author using strict architectural principles, the term is often used loosely to describe any simple URI-based request to a specific domain over HTTP without the use of an additional messaging layer such as Simple Object Access Protocol (SOAP). Implementations adhering to the strict principles of REST are often referred to as being “RESTful,” while those which follow a loose adherence are called “REST-Like”. Microsoft Dynamics GP Services can be considered REST-like (See Chapter 1: Microsoft Dynamics GP Service, page 3 of the Microsoft Dynamics GP Service Based Architecture Preview documentation).

A quick sample

As an example, imagine you need to build a service that interacts with the Microsoft Dynamics GP item master list: basically, a service that could produce the list of items and/or information about a specific item in the list, from a specific company database - in this case Fabrikam - and to be more precise, that company database resides within a specific tenant. Technically speaking, this service could also add or retrieve data for an item to and from the item master in Fabrikam, on the current tenant.

When building a REST-like service, you can must answer 3 basic questions:


  • What resources you are trying to define or expose
  • How are you going to represent the resources (URIs)
  • What actions are you going to support for each URI (HTTP verbs).


  • For our example, the resources will be defined by the hierarchy Tenants(Name:tenant_name)/Companies(company_name)/Items(item_number). The URIs are really dependent on where the service is going to be hosted, so for example, this could be in the form of http://somedomain.com:port_number/gpservice/ followed by the above hierarchy. The next thing in line is then to understand what HTTP verbs or actions are supported with each URI.

    Next, we need to determine the URIs for each resource. Right now we only need to determine the relative URIs since the absolute URI will be determined by where we host the service. The item master will be the root URI of the service (/). Using this syntax, /Items() will return all of items contained in the item master; /Items({ItemNumber}) will be the URI for each item within the item master.

    Under the current Developer's preview implementation, if you wanted to retrieve information about an item (HTTP GET), you would then use the following URI notation from your browser:

    http://localhost:8084/GPService/Tenants(Name=DefaultTenant)/Companies(Fabrikam,%20Inc.)/Items(2GPROC)

    By copy and pasting the above URL in the browser, the service call will generate a JavaScript Object Notation file (.json), as shown below:

    Items(2GPROC).json
    {
      "Status": {
        "CorrelationId": "d3056b1bb9d84775ad269abfa09cfa77",
        "Code": 200
      },
      "Payload": {
        "Trace": [],
        "ItemNumber": "2GPROC",
        "ItemDescription": "2 Ghz Processor",
        "NoteIndex": 333.0,
        "ItemShortName": "",
        "ItemType": "SalesInventory",
        "ItemGenericDescription": "",
        "StandardCost": 0.0,
        "CurrentCost": 250.0,
        "ItemShippingWeight": 0.0,
        "DecimalPlacesQTYS": "NotUsed",
        "DecimalPlacesCurrency": "One",
        "ItemTaxScheduleID": "",
        "TaxOptions": "Nontaxable",
        "IVIVIndex": 18,
        "IVIVOffsetIndex": 18,
        "IVCOGSIndex": 137,
        "IVSalesIndex": 112,
        "IVSalesDiscountsIndex": 128,
        "IVSalesReturnsIndex": 134,
        "IVInUseIndex": 0,
        "IVInServiceIndex": 141,
        "IVDamagedIndex": 141,
        "IVVariancesIndex": 783,
        "DropShipIndex": 445,
        "PurchasePriceVarianceIndex": 446,
        "UnrealizedPurchasePriceVarianceIndex": 446,
        "InventoryReturnsIndex": 450,
        "AssemblyVarianceIndex": 0,
        "ItemClassCode": "RM-ACT",
        "ItemTrackingOption": 1,
        "LotType": "",
        "KeepPeriodHistory": true,
        "KeepTrxHistory": true,
        "KeepCalendarHistory": true,
        "KeepDistributionHistory": true,
        "AllowBackOrders": true,
        "ValuationMethod": "FIFOPerpetual",
        "UOfMSchedule": "EACH",
        "AlternateItem1": "",
        "AlternateItem2": "",
        "MasterRecordType": 1,
        "ModifiedDate": "2017-05-21T00:00:00",
        "CreatedDate": "2017-05-21T00:00:00",
        "WarrantyDays": 0,
        "PriceLevel": "",
        "LocationCode": "",
        "PurchInflationIndex": 0,
        "PurchMonetaryCorrectionIndex": 0,
        "InventoryInflationIndex": 0,
        "InventoryMonetaryCorrectionIndex": 0,
        "COGSInflationIndex": 0,
        "COGSMonetaryCorrectionIndex": 0,
        "ItemCode": "",
        "TaxCommodityCode": "",
        "PriceGroup": "BUY",
        "PriceMethod": "CurrencyAmount",
        "PurchasingUOfM": "",
        "SellingUOfM": "",
        "KitCOGSAccountSource": "FromComponentItem",
        "LastGeneratedSerialNumber": "",
        "ABCCode": "B",
        "RevalueInventory": true,
        "TolerancePercentage": 0.0,
        "PurchaseItemTaxScheduleID": "",
        "PurchaseTaxOptions": "NonTaxable",
        "ItemPlanningType": "Normal",
        "StatisticalValuePercentage": 0.0,
        "CountryOrigin": "",
        "Inactive": false,
        "MinShelfLife1": 0,
        "MinShelfLife2": 0,
        "IncludeinDemandPlanning": false,
        "LotExpireWarning": true,
        "LotExpireWarningDays": 0,
        "LastGeneratedLotNumber": "",
        "LotSplitQuantity": 0.0,
        "UseQtyOverageTolerance": false,
        "UseQtyShortageTolerance": false,
        "QtyOverageTolerancePercentage": 0.0,
        "QtyShortageTolerancePercentage": 0.0,
        "IVSTDCostRevaluationIndex": 0,
        "UserCategoryValues1": "",
        "UserCategoryValues2": "",
        "UserCategoryValues3": "",
        "UserCategoryValues4": "",
        "UserCategoryValues5": "",
        "UserCategoryValues6": ""
      }
    }
    

    You can also retrieve an XML payload by specifying the extension in the URI, as follows:

    http://localhost:8084/GPService/Tenants(Name=DefaultTenant)/Companies(Fabrikam,%20Inc.)/Items(2GPROC).xml

    Here are other examples of URI notations to perform various service calls to retrieve data from Microsoft Dynamics GP, as provided in the Developer's preview:

    Checking the status of the GP Service.
    http://localhost:8084/GPService/Tenants(Name=DefaultTenant)/Companies(Fabrikam,%20Inc.)/Utility/Ping

    Obtaining help on supported HTTP verbs.
    http://localhost:8084/GPService/Tenants(Name=DefaultTenant)/Companies(Fabrikam,%20Inc.)/Utility/Help

    Retrieve information on customer AARONFIT0001 (Aaron Fitz Electrical).
    http://localhost:8084/GPService/Tenants(Name=DefaultTenant)/Companies(Fabrikam,%20Inc.)/Customers(AARONFIT0001)

    Retrieve information on customer COMPUTER0001(Computer World).
    http://localhost:8084/GPService/Tenants(Name=DefaultTenant)/Companies(Fabrikam,%20Inc.)/Customers(COMPUTER0001)

    Retrieve information on item number 100XLG.
    http://localhost:8084/GPService/Tenants(Name=DefaultTenant)/Companies(Fabrikam,%20Inc.)/Items(100XLG)

    Retrieve information on site 101G.
    http://localhost:8084/GPService/Tenants(Name=DefaultTenant)/Companies(Fabrikam,%20Inc.)/Sites(101G)

    Retrieve information on site 104G.
    http://localhost:8084/GPService/Tenants(Name=DefaultTenant)/Companies(Fabrikam,%20Inc.)/Sites(104G)

    Retrieve information on all companies under the current tenant.
    http://localhost:8084/GPService/Tenants(Name=DefaultTenant)/Companies(Fabrikam,%20Inc.)/Companies()

    Retrieve information about Fabrikam, Inc. under the current tenant.
    http://localhost:8084/GPService/Tenants(Name=DefaultTenant)/Companies(Fabrikam,%20Inc.)/Companies(TWO)

    I want to mention that there 2 HTML files provided with the preview, which contain JavaScript sample code showing how to access the Dynamics GP Service. These can be found under the Samples folder. The scripts show how to make use of the HTTP POST, HTTP PATCH, and HTTP DELETE actions to create a new, and update and delete an existing record in Microsoft Dynamics GP respectively.

    There's also a .NET sample application that show how to consume a GP Service as well. This sample can be loaded with Visual Studio in the Developer's Preview image.

    While this is all good, In my next article I will show how to build a Microsoft Dexterity-based service that can be consumed by other applications.

    Until next post!

    MG.-
    Mariano Gomez, MVP
    IntelligentPartnerships, LLC
    http://www.IntelligentPartnerships.com