Tuesday, September 8, 2009

Dynamics GP Developers: What language do you use?

Random note: Here is a great t-shirt that reminds me to try and make my blog posts relevant and valuable.


If there are any readers out there who are "GP Developers", I'd like to hear what languages you use to customize or integrate with Dynamics GP. Specifically, do you use VB.NET, or C#?

I used Visual Basic since the mid-1990s, so VBA and VBScript support in GP didn't require any transition for me, except to learn the quirks and proprietary objects, methods, and events. But I procrastinated with .NET, and finally made the transition in 2007 (I know, I know). Naturally, I just moved to VB.NET, which allowed me to focus on .NET, and not worry so much about language syntax. I think that was probably wise, as I'm constantly reminded of how amazingly expansive the .NET framework is--sometimes it can be tough just navigating through it without having to worry about language syntax.

However, in college I spent a year learning and developing with C++ and have studied C#, so the language and syntax shouldn't be terribly challenging, in concept. (I'm sure I'll accidentally type Dim quite a bit at first.)

As I've been getting help from my friend Lorren to better understand practical Object Oriented (OO) application architecture, and how to best design OO apps in .NET, I'm seeing that besides a few minor syntax and language benefits that I've known about, there are some fundamental benefits to C# that probably make well designed OO code more straightforward.

Most recently, I discovered Class Constructors in VB.NET. They've always been there, but until Lorren explained them to me, I had never used them. My interpretation is that VB.NET essentially hides the constructor from you, which can be convenient. But the downside is that when you want a constructor, you have to do silly things like declare "Public Sub New()" in your class, which is not terribly intuitive. We also discussed how VB Modules appear to provide the same functionality as a Static Class in C#.

So my very nascent understanding is that VB had to create workarounds in the name of convenience or simplicity, and those workarounds result in some potentially less-than-optimal implementations, or implementations that obscure the mechanics of .NET to the developer.

Aside from the specifics of the language itself, one of my concerns around developing in C# has been what I perceive as a relative shortage of C# developers vs. VB developers. If there are benefits of developing in C#, but I have a harder time finding a contractor to help me modify or write code, the benefits may not be worth it. So far, all of the GP developers I've spoken with use VB.

I'm sure there are plenty of C# developers on the planet, but are there many Dynamics GP developers who are proficient in C#?

I don't know.

If you code for Dynamics GP, what language do you use? Or if you know GP developers or GP partners or GP ISVs that do GP development, what language do they use?

Friday, September 4, 2009

SQL Query Optimization

If you are a Dynamics GP developer in the US, I'm sure you're looking forward to the upcoming holiday weekend so that you can sit down at your computer and relax by reading articles on the SQL Server Performance web site.

No??? So it IS only just me??? (blush)

I discovered the web site several years ago when I was working on a pretty challenging project. My client was receiving detailed billing data from a vendor and had asked me to develop a routine to validate the transactions against data in their database before importing the voucher into Dynamics GP. The challenge was that the vendor was sending over 250,000 records each week, and the single table in the client's operational system database was 2 terabytes.

So there I was, trying to do a JOIN of 250,000 records against a 2TB table. Not pretty. My initial query would just run, and run, and run, while hogging CPU and memory on the server. That's when I stumbled on the SQL Server Performance web site. I optimized my JOINs, I added more WHERE clauses, tweaked my indexes, and I learned all about "non-sargable" WHERE clauses. My eternal query eventually took less than 10 seconds to run, making me quite proud. ;-)

Since then, I've always been aware that whenever I write a complex SQL query, there is usually a different, and likely better, more efficient way to write it. If the query is only run once a week and it takes 10 seconds, that may be adequate and no further optimization may be necessary. But if the query is run 50,000 times a day, even a sub-second query may benefit from further optimization.

One of the biggest learning curves I had was how to analyze the performance of my queries and determine which part of the query was inefficient. I found a book on SQL Server query optimization that taught me the "Old School" method, using the SET SHOWPLAN_TEXT ON statement. When you run this statement, and then run your query, SQL Server will display the execution plan instead of your query results.

For example, these statements:

SET SHOWPLAN_TEXT ON
SELECT COUNT(*) FROM PM00200 WHERE VENDORID LIKE '%ACE%'

Would display this result:

|--Compute Scalar(DEFINE:([Expr1004]=CONVERT_IMPLICIT(int,[Expr1005],0)))
|--Stream Aggregate(DEFINE:([Expr1005]=Count(*)))
|--Index Scan(OBJECT:([TWO].[dbo].[PM00200].[AK6PM00200]), WHERE:([TWO].[dbo].[PM00200].[VENDORID] like '%ACE%'))

(Just make sure to run SET SHOWPLAN_TEXT OFF when you are done.)

I eventually got past the arcane presentation of the text plan information, learned how to review the operations being performed, and found that I pretty much needed to look at the inner-most (most indented) operation to see where I had opportunities to optimize my query.

On the other hand, most people use the more modern and convenient "Display Estimated Execution Plan" feature in Query Analyzer and SQL Server Management Studio. This feature displays a graphical representation of the query plan and includes much more information and statistics on each operation. If you highlight a query in Management Studio, you can use the CTRL+L shortcut to show the execution plan.



And if you hover your mouse over one of the steps, you will get more detailed information about the operation.




It isn't always obvious or easy identifying which operations can benefit from optimization, but an easy way is to start with the step that has the highest cost and start researching to see if there is a different way to perform the query step.

I learned that query optimization was much more of an art than a science, requiring situation-specific analysis, and consideration of the environment, database, and tables that are involved with the query. But based on my experience, my general rule is that if you have a query that is taking longer than 10 seconds to execute, it is likely that there are opportunities for improving its performance.

Thursday, August 27, 2009

Sales Tax Simplified

It seems like the Dynamics GP forums are alive with sales tax questions lately. So, I thought I might tackle this one in the same manner that I do in the classroom-- by breaking it down in to steps. I treat sales tax as a three step process.

1. Document Default
2. Item or Setup Default (depending on if you are working with Receivables or Sales Order Processing, for example)
3. Tax schedule comparison

So, for this post, we are going to keep it simple and look at taxes in Receivables Management and Payables Management. I promise another post on Sales Order Processing and Purchase Order Processing next week :) But, for now, lets keep it simple.

Let's start with Step 1. There is one key setup that can impact the tax schedule that appears on a document (whether it be Payables or Receivables) by default. In your company setup, Tools>>Setup>>Company>>Company>>Options, there is a setting to Use Shipping Method to Determine Default Tax Schedule.

  • If this option is marked, then the tax schedule that appears on the transaction will be dependent on whether the shipping method is a pickup or delivery method (more on this later).

  • If this option is unmarked, then the tax schedule that defaults on the transaction will always be the Vendor Address' schedule (on Payables) or the Customer Address' schedule (for Receivables)
Now, let's look at Step 2. Now, Step 2 assumes that in your setup you have chosen Advanced for your tax calculations (Tools>>Setup>>Purchasing/Sales>>Payables/Receivables>>Options) rather than Single Schedule. Single schedule will always charge according to Vendor or Customer Address' schedule without Step 2 or Step 3.
In Step 2, we need to find the setup schedule (in Payables or Receivables). This is the schedule specified for each amount (Purchases, Sales, Freight, Misc, etc) in the setup options window mentioned above. In most examples in training manuals, these schedules are setup to include ALL DETAILS.
So, in Step 3, the schedule from the document (Step 1) is compared to the schedule from setup (Step 2). Details that the two schedules are compared, and only those that exist in both places are calculated.
Easy right? I know, I know..you are probably saying, huh? So, lets look at an example. Let's say that I have the following tax schedules set up:
  • MOTAX: Contains the MOSTATE, KCCITY, MOSPEC, and JCKCTY Details which will be assigned to my Missouri based customers

  • KSTAX: Contains the KSSTATE and KCKCITY Details which will be assigned to my Kansas based customers

  • VALID: Contains the MOSTATE, KCCITY, JCKCTY, KSSTATE, KCKCITY which contains all of the currently valid tax details. I have purposely left off MOSPEC, it was a special tax that was only charged last year in MO and is no longer valid.
I set up my customer ABC AUTO with the tax schedule MOTAX, and I assign KSTAX as the default tax schedule for sales in Company Setup. VALID is specified in my Receivables Management Setup as the tax schedule for Sales.
Let's assume that we have chosen to have shipping method determine default tax schedule. So if I enter a Receivables invoice for ABC AUTO, the tax schedule will default as follows:
  • Shipping Method with a delivery type: MOTAX (from Customer Address)

  • Shipping Method with a pickup type: KSTAX (from Company Setup)
So, lets assume I use a Shipping Method with a delivery type, so MOTAX defaults. This would then be compared to the VALID tax schedule specified in setup. What is in common?
  • MOSTATE, KCCITY, JCKCTY are the only taxes that would be calculated, since MOSPEC did not exist in the tax schedule in Receivables Management setup for comparison
I think of the tax schedule specified in setup as my "control" schedule, containing all valid tax details to be used in comparison against the documents. In many cases, this would be all details. But in some cases, as outlined above, it may be easier to remove a tax detail from the one control/setup schedule than to remove it from all schedules that contain it. This is also a great approach if a tax is only valid (or invalid) for certain portions of the year (think of sales tax holidays).
Please post back your questions or comments or examples to help with the understanding. I promise more next week on distribution. Have a great weekend!
Update from 9/2: Mike Lupro was kind enough to share his naming convention for tax schedules and details. Mike says, "I recently implemented a pretty simple tax scheme for a client and found myself getting wrapped around the axle with schedule names vs. detail names. I finally used the following naming scheme so the client could tell if they were dealing with a schedule or a detail. And to easily have the items sort into a state-by-state order. It also helped them decide if it was a purchasing schedule/detail vs. a sales schedule/detail. Overall it was a pretty simple setup and the naming convention would get more complicated if the taxes were more granular." Thanks Mike!




Forecaster Users and Dynamics GP Users

Do you ever have an issue come up, and you know you read about it somewhere...but you just can't find the KB article or the blog lnk. But it still keeps eating at you?

That happened to me this morning, when a client had tried to take her Dynamics GP user ID and make it work for Forecaster 7. Needless to say, it didn't work :) Because of the encryption that GP uses when creating a user ID in SQL, that same user ID will not work with Forecaster even if you assign the appropriate database permissions.

I thought I would post it here, so I remember it the next time :) The client does get points for trying to be efficient, though.

Monday, August 24, 2009

Integration Manager error with a twist: All windows and palettes must be closed

A few days ago on Experts Exchange, I fielded a question regarding the very familiar Integration Manager 9 error:

"The destination could not be initialized due to the following problem: All Microsoft Business Solutions - Great Plains windows and palettes must be closed before starting an integration."

This is a common error, but is usually easily solved by just closing any open windows. What made this a little unusual were some of the details:

1) IM 9 was being run in a Citrix environment
2) IM worked fine the first time the integration was run, but after that, the error occurred
3) The user was sure that all GP windows were closed

The only thing that seemed to be uncommon was that they were running IM in a Citrix environment. So we tried checking for orphaned Dynamics.exe processes, and even tested running the integration when no other users were on the server. But the problem still occurred.

The user shared that if IM was shut down and restarted, the error still occurred. But if GP was shut down and restarted, the error went away for one more integration (but would still happen again after the first integration completed).

After a few rounds of questions, the user posted a key piece of information: The user was logging into a different GP company after the first integration completed and running the same integration in a second GP company.

So I installed IM 9 in a test environment, then had to create a test company in GP 9 so that I had two companies to switch between. I ran the sample GL Transaction integration into TWO, and it ran fine. I then switched to my Test company, and when I tried to run the same integration, sure enough, the error occurred.

I knew I didn't have any GP windows open, so something else was causing the problem. Staring at GP for a few seconds, it occurred to me that the GP "Home Page" was technically a window. Curious, I clicked on the "X" to close the home page, ran the integration again, and violá, IM ran just fine.

I tested this several times and confirmed that when switching companies between IM integrations, IM considers the GP home page to be an open window.

So, I offered that the user either manually close the Home Page between integrations after logging into the second company, or change their settings so that the Home Page does not open. Thankfully, that solved the problem for them as well.

Wednesday, August 12, 2009

The Ever Expanding Payroll System

In the past couple months, I have fielded requests from a variety of clients for add-on modules for Payroll. The base payroll module in Dynamics GP has some great functionality; but as companies look for greater efficiencies and ways to streamline operations, they start to look for ways to expand the functionality of the system to better meet their needs. What was once a manual process may need to become an automatic process. What was once handled through printing, folding, and sending may now need to be sent through email or delivered through a portal.



So, I thought I would share some of the options I have put out there to help with the processing of payroll. This is by no means a complete list, so please share additional options in the comments and I will update the blog entry to include them :)



First, don't forget about the Payroll Extensions. Unless customers opted out of these, they get them automatically (for a small bump in their product list cost, and therefore enhancement costs). Functionality to track deductions in arrears, to pass liabilities from payroll to payables (e.g., deductions, taxes, etc), and to blend overtime rates is included in the Payroll Extensions.



Advanced Payroll is an additional module (which means additional cost) from Dynamics GP, that adds some specific functionality to the payroll module. It will not apply to everyone, but for those that have the need, it can be a great fit. Capabilities include posting payroll hours to unit accounts in the general ledger, managing pay policies which include different pay rates based on shift, department and/or position, calculation and reversal of payroll accruals, allocation of employee costs across departments, and advanced labor reporting functionality.

PTO Manager is a relatively new member of the family, and it can replace the standard payroll or human resources vacation and sick accrual functionality while adding functionality like allowing two accrual schedules to be applied to vacation time simultaneously (for example, a base schedule plus a bonus schedule given to select employees) and management of carryover hours.

If we move outside of the Dynamics GP client, in to Business Portal, there is a whole other world that opens up in terms of employee self service, including:
  • Benefit Self Service: Online access for employees to enroll in benefits. Refreshingly easy to configure and control, I am repeatedly surprised by what a simple, yet functional, add-on this can be. My husband works for a large corporation that uses a large product that is not nearly as easy to use, or as intuitive.
  • Human Resources Online: Online access for employees and managers to access pay stubs, personal information, skills and training, as well as other HR features like recruitment.


Okay, so those are a few of the Microsoft ones that are out there. But how about third party products? Here are a couple that keep coming up in my discussions with clients:
  • Greenshades: I used to think of them as primarily dealing with taxes, which they still do...offering a variety of tax solutions for integration with Dynamics GP payroll. However, they also have a variety of other products to address additional PTO management needs, paperless payroll (think sending pay stubs and W-2s electronically, and online access to employee information).
  • Integrity Data: Another familiar face that also offers leave management (with online self service capabilities), position and FTE control features, employee allocation capabilities, and emailing of earning statements.
  • JAT: Offering carrier interface (for those using HR) for benefit information, as well as electronic delivery of pay stubs and online access to W-2 information.

I am sure there are many more out there that I should mention, so I will also put a plug in for www.isv-central.com and the Microsoft Solution Finder as great tools to assist in your search for that perfect module :)

Have a great end of your week!

Partner Support Resources for Dynamics

I am sure many of you are already aware of the forums out there, both those sponsored by Microsoft, and those that are independent (e.g., Experts Exchange, Egghead Cafe, etc). But I thought I would send out a reminder of the partner-specific resources available to Dynamics partners. Check out the links on https://mbs.microsoft.com/partnersource/resources/discussions/.

In addition to the public forums, there are private forums for partners only, and (my personal favorite) the partner online technical communities-- which are managed by Microsoft Dynamics support folks. The technical communities can be a great way to build knowledge and leverage your support plan without using a case. I find myself posting there with questions that I would never "waste" a case on, but would love to have a definitive answer on.

These forums (as well as search engines and blogs) can be a great resource when you have issues that either do not warrant or a case, or you just want another opinion. Personally, I also enjoy running across the same folks in different forums, it starts to feel like a community of sorts (which, for those of you who know me, is one of my favorite things to talk about...the value of building relationships in the Dynamics community).

Update from the fabulous David Musgrave (Thanks David!) of a few more that he regularly checks out...

Please share some of your favorite independent forums, and I will update this post with them. Happy hunting!