Friday, June 22, 2018

Using eConnect from Dexterity. Part 1.

As I mentioned in a previous post eConnect is the tool of choice when integrating to Dynamics GP.  Dexterity is the tool of choice for customizing Dynamics GP.  You can use Dexterity to access all the tables in GP, and you can CRUD all that data as you'd like.  However you do so at the risk of introducing corruption in the GP database if you don't know exactly what you are doing.

Add to that the hazards of upgrades and frankly I'd just assume avoid all that trouble.  This is where eConnect comes to the rescue!

eConnect is the tool of choice for integrations to GP because it acts as an API to the data layer by way of the business logic.  This means it will default data where it can, and prevent you from putting invalid data where you can't.  And it's almost upgrade-proof.  There are situations where upgrades introduce new requirements on eConnect, but they are rare.  This makes upgrades much more manageable.

So if you are writing Dexterity code and want to integrate data to GP you can certainly use eConnect.  However it helps to understand how eConnect works.

As a longtime Scribe user I've learned that you need to use a bottom-up approach when integrating.  Since Scribe bases its GP integration on eConnect I never realized that the reason it did that was because eConnect required it.  It wasn't until I started to use eConnect directly that I realized Scribe did it this way because eConnect did it that way.

What this means is you have to insert your detail transactions before the header.  For example if you are trying to create a GL transaction you will have to create all the GL lines before you can insert the GL header.  This applies to most transactions in Dynamics GP.

If you don't have any experience with Scribe or eConnect (and perhaps even if you do) I'd suggest installing the eConnect SDK that comes with GP.  While this is not required there's a nugget in there that is the eConnect Programmer's Guide.  When you install the SDK it installs the Guide in both CHM and PDF form (Program Files (x86)\Microsoft Dynamics\eConnect xx\Help.)  In the back of the CHM is the eConnect Node References that will really help out.

For some odd reason Microsoft left the Node reference out of the PDF version of the guide.

In my next post I'll describe how I put eConnect to work from inside of Dexterity.

Loss of database access in SQL

I administer several SQL Server instances.  To connect to these I use my domain account which has Sysadmin privilege on each server.

Last night when I logged in to perform some updates I was greeted with the "server principal is not able to access the database under the current security context" message.  This was to a SQL 2012 server, again with my domain account.

Not only is my domain account a Sysadmin but I'm also a local admin on the server.  I was able to access the server just fine using SA.  I am also able to access other servers fine with my domain account.  Just this one SQL 2012 instance was giving me trouble.

This morning I've been searching the heck out of this and testing all kinds of things.  I was able to create a SQL user and give it Sysadmin and access all the databases just fine.

Finally I tried to take away and give back Sysadmin to my user - that didn't work.

What did work was dropping my user altogether, then adding it back and granting it Sysadmin again.  All seems well now.

Simply inexplicable!