Tampilkan postingan dengan label Dynamics GP 2013. Tampilkan semua postingan
Tampilkan postingan dengan label Dynamics GP 2013. Tampilkan semua postingan

Rabu, 15 Februari 2017

VST: An error occurred while loading or initializing an addin

As I mentioned before, I am now the Lead Software Engineer at Mekorma. I love it here as I get to work with some really talented software engineers and developers, all of which challenge me everyday. One of the cool new products we are working on, Mekorma Multi-Batch Management, allows you to build payment batches, print and post payments, and generate electronic funds transfer (EFT) and positive pay (Safe Pay) files, across companies, and across multiple checkbooks, with some minor configuration and just the click of a button. You can see an in-depth video on the product here.


Part of the challenges of building Multi-Batch Management were its extensive interfacing with both our own Mekorma MICR product and Microsoft Dynamics GP, and in particular, the Safe Pay module - Multi-Batch Management is designed to drive the Microsoft Dynamics GP user interface, thus eliminating the need for invasive code.

If you have worked on integrating code for Microsoft Dynamics GP, you are certainly familiar with the challenges surrounding the response to Dexterity modal dialogs. This is true for Microsoft Dexterity service enabled procedures as much as it is true for standard applications like ours, that simply try to drive the user interface.

NOTE: Dexterity does not have a programmatic mechanism to respond to modal dialogs. As it stands, only Visual Basic for Applications (VBA) and Visual Studio Tools for Microsoft Dynamics GP (VST) provide event handlers for modal dialogs.

VST aids in responding to Dexterity modal dialogs by allowing a developer to define form or window level modal event handlers. Because our code needed to respond to dialogs in Safe Pay only when our process was running, it was necessary to create an application assembly for our dictionary, that we could then reference in a Visual Studio Tools project. In addition, we needed to reference the Safe Pay application assembly as well. The project reference looks something like this:


Project References

Once references are added to the project, the tendency is to immediately add all event handlers to the Initialize() method within the GPAddIn class, as shown below:


public void Initialize()
{
Dynamics.Forms.SyErrorMessage.SyErrorMessage.OpenBeforeOriginal +=
Dynamics_SyErrorMessage_OpenBeforeOriginal;
Dynamics.Forms.CmTransactionEntry.CmTransactionEntry.BeforeModalDialog +=
Dynamics_BeforeModalDialog;
Dynamics.Forms.CmEftGenerateFiles.CmEftGenerateFiles.BeforeModalDialog +=
Dynamics_BeforeModalDialog;
SafePay.Forms.MePpTransactions.MePpTransactions.BeforeModalDialog +=
new EventHandler(SafePay_Transactions_BeforeModalDialog);
}


Unfortunately, this approach has a problem: let's assume Safe Pay is not installed, therefore, the Safe Pay application dictionary and application assembly are missing from the Dynamics GP installation folder. Since the Initialize() method is the entry point to your VST application, when the runtime engine attempts to load your assembly, your application would contain a reference to a non-existing assembly. This in turn will cause the runtime engine to produce the following error:

"An error occurred while loading or initializing an addin. As your administrator to check the Windows event log for more details. Dynamics will now close."


This is always been accepted as "the way things work". Unfortunately, we couldn't live with the status quo as it meant that customers who did not require the Safe Pay module would have to install it just for the sake of our assembly not failing.

We then attempted to move our event handler registration into it's own method, enveloping the call in a try..catch block:


public void Initialize()
{
Dynamics.Forms.SyErrorMessage.SyErrorMessage.OpenBeforeOriginal +=
Dynamics_SyErrorMessage_OpenBeforeOriginal;
Dynamics.Forms.CmTransactionEntry.CmTransactionEntry.BeforeModalDialog +=
Dynamics_BeforeModalDialog;
Dynamics.Forms.CmEftGenerateFiles.CmEftGenerateFiles.BeforeModalDialog +=
Dynamics_BeforeModalDialog;

try
{
InitializeSafePay();
}
catch (Exception e)
{
throw new Exception(e.Message);
}
}

public void InitializeSafePay()
{
SafePay.Forms.MePpTransactions.MePpTransactions.BeforeModalDialog +=
new EventHandler(SafePay_Transactions_BeforeModalDialog);
}


The above produced virtually the same results. That is, the exception was still being displayed. Now, quite clearly, if we commented out the throw statement, the exception would no longer present itself and the message would not appear, precisely what we needed since we did not want to alert of the missing assembly and prevent the user from login into Dynamics GP.

NOTE: Alternatively, we implemented tracing capabilities for our assembly, so now all exceptions are recorded in a log file.

Special thanks to my Sr. Software Engineer, Lee Butenhoff for researching and providing a solution to this long standing issue.

Until next post!

MG.-
Mariano Gomez, MVP

Selasa, 14 Februari 2017

Revisiting: SOP Quick Print

Continuing with my Revisiting series, today I look at an article I wrote in 2009 regarding the SOP Quick Print feature.

Summary

SOP Quick Print is one of those gems in Microsoft Dynamics GP hidden within plain site. Written by my friend David Musgrave, it was designed to save time when saving and printing sales orders, fulfillment orders, and invoice. SOP Quick Print is activated by pressing CTRL + Q on your keyboard, and after a simple setup, it's good to go.

SOP Quick Print Setup window
One of the frustrating things about saving most documents in Dynamics GP, is that the window is cleared completely from the document that you were working on. Depending on what you are trying to achieve, this can be an inconvenience if all you wanted to do is save your document up to that point, so you can keep working on it. Current business logic would have you retrieving that document once more by either typing the document number or retrieving it via a lookup. With SOP Quick Print, you can save the document while keeping it displayed on the Sales Transaction Entry window.

SOP Quick Print and the Web Client

In order to achieve the printing and the saving of the document, SOP Quick Print creates a Dynamics GP macro on the fly, with the necessary macro lines (based on the selected options during configuration) to print, save, and retrieve the document when saved. The macro looks something like this:

ActivateWindow dictionary 'default'  form 'SOP_Print_Options' window 'SOP_Print_Options'
  MoveTo field 'Print Button NONE'
  ClickHit field 'Print Button NONE'
NewActiveWin dictionary 'default'  form 'Report_Destination' window 'Report_Destination'
  MoveTo field 'Print to Screen'
  ClickHit field 'Print to Screen'
  MoveTo field 'OK Button'
  ClickHit field 'OK Button'
PrintDialog copies 0 from 0 to 0


The macro is saved in the Data folder of the current instance.

The issue with macros is, they are not compatible with the Dynamics GP web client, so unfortunately, this great feature is not available when running the web client. But if you currently enjoy the desktop client, there should be absolutely no reason for you not to take advantage of this feature.

I have tested this across all newer versions of Dynamics GP, since GP 2013 and the feature continues to work as expected.

Until next post!

MG.-
Mariano Gomez, MVP

Kamis, 17 September 2015

Microsoft Dynamics GP Web Client no longer working on Google Chrome 45

If you had gotten used to running the Microsoft Dynamics GP web client on Google Chrome, chances are you have just woken up to the constant requests for installing the Silverlight plugin. You may have attempted the installation a few times by now, only to notice that you are still being requested to install Silverlight.

Microsoft Dynamics GP Web Client on Chrome 45 

Google Chrome users who normally relied on functionality that NPAPI plugins provided won't be able to make use of them anymore with the release of Chrome 45. NPAPI-only plugins such as Java or Silverlight are used throughout the web and while their use is declining, there are numerous applications and services that make use of either one or another plugin - for example, your beloved Microsoft Dynamics GP web client.

This Chrome Extensions article explains the security concerns behind the use of NPAPI-based plugins, mainly, the ability of said plugins to gain access to a user's local machines. Any security gaps in such plugins would render a user's machine vulnerable to exploits by malicious code.

However, this should not at all come as a surprise, since Google had it in the works to remove NPAPI support since September of 2013, see Saying Goodbye to Our Old Friend NPAPI, with Chrome 45 selected as target for final deprecation.

So what are the alternatives?

Well, you can fall back once more to Internet Explorer 10 (desktop), Mozilla Firefox, or even Apple's Safari. If my mind serves me correctly, the latter two will have some minor limitations (as in "may not be fully compatible").

Option number 2 would have you downgrading Chrome, if you are willing to get the installer from non-Google sites like Old Apps or File Hippo.

As a final note, the following browsers DO NOT support Silverlight:

Microsoft Internet Explorer 10 modern UI
Microsoft Edge (formerly code name Spartan, available on Windows 10)
Google Chrome (version 45 and above)
Opera (version 20 and above, current version is 32)

Until next post!

MG.-
Mariano Gomez, MVP

Jumat, 29 Mei 2015

"A SQL Server login already exists for . Delete the user and create a new user" error when switching a user ID from web client only to mixed mode access

I'm completing the deployment of Microsoft Dynamics GP 2013 R2's Project Accounting and Time Entry approval workflow for a customer in Alabama who is currently deploying web client for extranet access (and timesheet entry) and desktop client for intranet access.

As a result, since time entry employees are remote, we decided to setup these user accounts as web client only. However, the customer wanted to provide an alternative to the web client in case it became unavailable. This meant that these users would needed the ability to access the Microsoft Dynamics GP desktop client via a Terminal Server provisioned (albeit temporarily) to support this goal.

The Problem

To meet this requirement, we needed to adjust the user accounts in Dynamics GP to also support SQL Server authentication (in addition to web client access), by deselecting the Web Client user only check mark and completing the SQL Login credentials information. Upon attempting to save the changes we received the following error:

A SQL Server login already exists for userID. Delete the user and create a new user.


As it so turns out with most application errors, you cannot just follow the instructions literally to fix the problem. In this case, we had more than 85 web client only user accounts created so "Delete the user and create a new user" wasn't an option and I don't know why I had a gut instinct this recommendation would not work anyways.

It also turns out that I tested this in Microsoft Dynamics GP 2015 and had no issues switching a user account from Web Client user only to a mixed mode access user account.

NOTE: "mixed mode access" user is a terminology I came up with to identify a Microsoft Dynamics GP user account with access capabilities from both the web client and desktop client.

The Solution

In troubleshooting this problem, the first thing is to focus on the first part of the error message, "A SQL Server login already exists". If a login already exists on SQL Server, then it should be visible under Management Studio - bear in mind that each Dynamics GP user account was setup as a web client only account to begin with. In principle, there should be no SQL Server security principal for these type of accounts.

Management Studio did not show any account created for the Dynamics GP under the Security folder. So the next logical thing would be to run a statement to check for a SID for the account in question:

SELECT suser_sid('TheUserID');

This statement returned an actual SID number (a long hexadecimal set of characters), confirming at least there was a corresponding SID for the account, even though we could not see the actual account in Management Studio.

Next was to verify then, what account was assigned to that SID. In order to do this, I ran the following SQL statement:

SELECT name FROM sys.server_principals where sid = (SELECT suser_sid('TheUserID'));

As it turned out, this statement returned no results. So here's the conundrum... GP thinks there's a SQL login for a user account that doesn't really exists on SQL, but has a SID.

Now, because there wasn't an actual SQL login for the user ID in question, I went ahead and setup a new SQL login with the user account by running the following statement:

sp_addlogin('TheUserID', 'somePassword');

The statement was successful and I could now see the SQL login under the security folder.

The next thing was to then reset the Dynamics GP web client user flag and assign the SQL login to the user account:

UPDATE SY01400 SET WCUser = 0,  SQLLoginID = 'TheUserID' WHERE USERID = 'TheUserID';

Since Microsoft Dynamics GP passwords are encrypted on SQL Server, you will now need to log into Dynamics GP, pull up the user account under the User Maintenance window, and change the password in the SQL login credentials section.

I cannot assess whether this is a bug or not, but suffice to say the same behavior is not present in GP 2015, so I must lean towards it being a bug.

I hope you find these troubleshooting steps useful.

Until next post!

MG.-
Mariano Gomez, MVP

Kamis, 12 Februari 2015

Microsoft Dynamics GP 2015 Identity Management

Hi everyone! It's been hectic around here with a few projects going live in these days, in addition to preparations for Convergence 2015 here in Atlanta.

I wanted to draw your attention to two videos currently posted on the Microsoft Dynamics YouTube channel, related to the Identity Management feature.

Identity Management was introduced with Microsoft Dynamics GP 2013 R2, so is probably good to go back and review the original feature design goal with Tara Higgins with the Partner Technical Consulting team.



With Dynamics GP 2015, the feature was extended to cover authentication with organizational accounts, which provides single sign-on capabilities for Microsoft Azure AD accounts. Identity Management for organizational accounts is a web client feature only. Take a look at this video by my buddy Jason Lech with the Escalation Engineering team.



My goal is to release a video showing a real life example on how to set this up. So stay tuned.

Until next post!

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

Rabu, 07 Januari 2015

SOP Quick Print feature does not work when window ribbons are enabled

Happy New Year!! Hope all of you had a great time with family and friends and that you are back getting used to the daily grind once more.

Today, I want to kick off the year with an issue in Sales Transaction Entry window related to the cool ribbons implemented since Microsoft Dynamics GP 2013 R2. By now, you are probably getting used to the absolutely gorgeous user interface which features Microsoft Office style ribbons on every window. Furthermore, you probably already know that the use of such ribbons is actually customizable and in many ways optional - albeit being the default configuration - as described by fellow Microsoft Dynamics GP MVP, Leslie Vail in her article GP 2013 R2 Ribbons. As it turns out, there's a Dex.ini switch, EnableWCRibbons=FALSE, that controls whether ribbons are enabled within Microsoft Dynamics GP or not. When ribbons are enabled, users can further customize the appearance of the action pane or return to the traditional menu bar for each window.


User Preferences window

Yesteryear (2009), I wrote an article talking about The wonders of CTRL+Q: saving and printing SOP documents in one step and how the Quick Print feature made life easier to the poor souls out there who needed a quick shortcut to printing SOP documents from the Sales Transaction Entry window. In that article I detailed the mechanics behind the feature, written by my good friend David Musgrave.

As fortune would have it, when ribbons are enabled and you are either using the Action Pane or the Action Pane Strip layouts, the Quick Print feature does not work. However, if the User Preference is returned to Menu Bar (you will need to exit Dynamics GP and re-launch for the changes to take effect), the Quick Print option (and CTRL+Q keyboard combination) works just fine.

While clearly an inconvenience, this can hardly be labeled a bug since the feature is still present within the application when the Window Command Display setting is set to Menu Bar as part of the user preferences. It would be nice, however, to have this fixed for Dynamics GP in desktop client mode. I can see how this may or may not work under web client mode as the browser keyboard shortcut combinations take precedence over the application's shortcuts.

Until next post!

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