ClassicPress Plugin Development: Coding Standards

ClassicPress PluginsThis post is part of the ClassicPress Plugin Development series in which I am going to look at both best practice for developing plugins and how I approach some requirements as well as some of the functions I commonly use.

In the last post, I covered using semantic versioning or (semver) when developing plugins for ClassicPress.

When developing plugins, ClassicPress largely uses the same coding standards as WordPress:

From the coding standard links above, I do follow the ones for HTML and CSS pretty much 100%, but the PHP one has a few items for which I take a slightly different approach. The idea behind coding standards is to make code readable to other people, so I largely take the view that if there is part of the standard you don’t like, then as long as you’re consistent in how you break the standard, code will still be readable.

The above opinion on adhering to coding standards is in reference to greenfield development; if contributing to an existing plugin, code to the standards used for that plugin. If contributing to core, then adhere to the standards as written.

Click to show/hide the ClassicPress Plugin Development Series Index

Black Boxes Printing Instead of Images on Standard Reports in Microsoft Dynamics GP Now Fixed

Microsoft Dynamics GPThere was a recent issue with the Report Writer reports printing a black box instead of an image. This problem was the result introduced by a Windows update and quickly acknowledged as an issue by Microsoft.

This is an example of how the standard report looks when the bug is present:

Black box showing on Report Writer report

The Dynamics GP Support and Services Blog posted about the problem on the 12th March and have posted regular updates on the progress of the investigation.

The latest update on the 22nd was that a new update had been released which fixed the problem for legacy OS’s like Windows 8 and Windows Server 2012 which follows current versions having working updates available from the 19th.

Web Services for Microsoft Dynamics GP Fall 2020 Release Upgrade Error

Microsoft Dynamics GPWe’ve just upgraded another client to Microsoft Dynamics GP Fall 2020 Release; everything during the upgrade went smoothly until we came to upgrading the web services. The test environment was created by replicating the live servers into a sandbox environment.

I was pretty much expecting to encounter the problem we did as we were moving from using a SQL Server security store to an Active Directory security store. The error received was:

Security object error upgrading Web Services

A loader exception has occurred.
Loader Errors:
- Microsoft.Dynamics.Security.InvalidSecurityContextException: Microsoft.Dynamics.Security.NonExistentSecurityObjectException : The security object does not exist.  Key = 25cc1a21-2cc4-4b13-a1c8-eea186fb688a
   at Microsoft.Dynamics.Security.ConcreteValidator.ValidateContext(SecurityContext context)
   at Microsoft.Dynamics.Security.SecurityService.Get(SecurityContext context, Key key)
   at Microsoft.Dynamics.Security.AzManTaskServiceImplementation.GetTask(SecurityContext context, TaskKey taskKey)
   at Microsoft.Dynamics.GP.GPSecurityMetadataSystemLoader.PersistTaskForAction(Action action, Task task, Keyword keyword)
   at Microsoft.Dynamics.GP.GPSecurityMetadataSystemLoader.PerformActionOnKeywords(Action action)
   at Microsoft.Dynamics.InstallData.Loader.Process(String[] args)

As the error referred to a security object error, my thinking immediately went to the new security store as being the issue. Due to the change in method I opted to remove the web services and do a reinstall; I tried using the built-in removal process in the Web Services Configuration Wizard, but this took a very long time to run and then crashed, so I used a couple of Microsoft supplied scripts to remove all of the web services objects from the company databases first and then from the system.

Once the web services had been completely removed, I re-ran the Configuration Wizard and deployed the web services again. The deployment ran through without any issues and we were able to test web services without encountering any further issues.

The lesson, which confirmed what I expected, is that if you change the security store type, you need to remove the web services from all companies and do a redeploy.

Remember to Reactivate Jet Reports When User Made Designer

Jet ReportsI’ve been doing a lot of work with a client on Jet Reports recently. While we were doing a training session, we created some new users and changed some from being ordinary users to being designers via the Jet Licensing portal. When the first user launched Excel, they found they were still an ordinary user without access to design mode.

They logged out and back in without the license changing at all.

The key to resolving this, was for that user to reactivate Jet Reports using the Activate from Jet Service Tier option on the Jet ribbon to to pick up the changed license.

Web Services for Microsoft Dynamics GP: How to Setup an Active Directory Security Store

Microsoft Dynamics GPTo use the Web Services for Microsoft Dynamics GP with TLS 1.2 you need to do two things:

  1. Upgrade to the Fall 2020 Release; you can’t just apply the hotfix to an October 2019 or earlier release, but have to use the full download media.
  2. Create an Active Directory Security Store.

Upgrading Dynamics GP is not a problem, but Active Directory isn’t my area of expertise. Fortunately, Microsoft have a set of instructions on the Dynamics GP Support and Services Blog which takes you through the creation of the security store.

Once the security store has been created, you need three pieces of information for the install of the web services:

  1. Name of the domain controller.
  2. Port 389.
  3. The partition string entered when creating the security store.

Recent ISC Software Webinar: Controls & Security in Microsoft Dynamics GP

ISC Software SolutionsIn our most recent webinar, we took a look at Controls & Security in Microsoft Dynamics GP. In this webinar, we covered how you can improve controls and security in Microsoft Dynamics GP using a mix of standard ad third party functionality. If you want to catch up on this, or any other, webinar, you can do so here.

In this blog post, I am going to recap the webinar and cover the salient points:

  1. Introduction
  2. Posting Controls
  3. Workflow Approvals
  4. Automation
  5. Security Setup
  6. Field Level Security
  7. Report Security
  8. Single Sign-on
  9. Audit
  10. Conclusion

Introduction ^

As always in this type of webinar, I try to use standard functionality as far as possible, but this is not always possible as not all of the areas being covered are included as standard. This was a deliberate design decision from the very creation of Microsoft Dynamics GP where they decided that supporting third parties would allow many more developers to work on modules for the system and encourage competition and improved standards from those third parties (known as Independent Software Vendors or ISVs for short).

There are three key areas where I am recommending third party modules and I will try to be clear when I am doing this.

Continue reading “Recent ISC Software Webinar: Controls & Security in Microsoft Dynamics GP”

ClassicPress Plugin Development: Semantic Versioning 2.0

ClassicPress PluginsThis post is part of the ClassicPress Plugin Development series in which I am going to look at both best practice for developing plugins and how I approach some requirements as well as some of the functions I commonly use.

When developing plugins for ClassicPress, you need to develop using semantic versioning (or semver) as this will be a requirement of the ClassicPress Directory.

Semantic Versioning is a versioning scheme for using meaningful version numbers which can be used to avoid incompatibilities.

semver version numbering works using three segments:

  1. MAJOR version when you make breaking changes where users will need to take some action during an upgrade.
  2. MINOR version when you add functionality in a backwards compatible manner which users can simply apply without taking any other action.
  3. PATCH version when you make backwards compatible bug fixes which, like MINOR versions users can apply without taking any other action.

One key point to note when using semver, is that when a versioned release has been made, nothing in that release can be changed; a new version with incremented number must be released instead.

Additional labels for pre-release and build metadata are available as extensions to the MAJOR.MINOR.PATCH format; pre-release versions often have a MAJOR version number of 0. When a plugin is ready for release to production it should be released as version 1.0.0.

Continue reading “ClassicPress Plugin Development: Semantic Versioning 2.0”

VBA Snippets: Execute URL or Application

MicrosoftThis post is part of the series on VBA Snippets.

it is possible to execute a URL or application in VBA using the Windows Shell Execute API function. In this snippet I am executing a URL, but this could be an application.

Before you can call ShellExecute in code you need to add the following line to the declarations at the top of the mdoule:

Private Declare Function ShellExecute Lib "shell32.dll" Alias "ShellExecuteA" (ByVal hWnd As Long, ByVal lpOperation As String, ByVal lpFile As String, ByVal lpParameters As String, ByVal lpDirectory As String, ByVal nShowCmd As Long) As Long

The following VBA command will execute the supplied URL (or application); the highlighted variable contains the URL:

iResult = ShellExecute(0, "open", sReportURL, vbNullString, vbNullString, vbNormalFocus)

You can then use the iResult for error handling.

VBA Snippets: Sleep

MicrosoftThis post is part of the series on VBA Snippets.

The following VBA snippets can be used to set a pause (sleep) in the code.

The first one needs to be in the declarations at the top of the module:

Private Declare Sub Sleep Lib "kernel32" (ByVal milliseconds As Long)

The second is used where you want the code to pause (my recent use was to pause for five seconds after an error and before retrying the action):

Sleep (1000 * 5)

The highlighted section is the time; 1000 milliseconds multiplied by 5 to give me 5 seconds.

VBA Snippets: Series Index

MicrosoftWe’ve recently taken on a new client for support of Microsoft Dynamics GP who has a number of modified forms and reports which have been extended with VBA code to add additional functionality. I have done a reasonable amount of VBA and VB6 in the past, but that was sometime ago and I’ve found myself searching online for examples on how to do some things when they’ve asked for further modifications, so I’ve decided that I’ll post snippets of VBA code here so I can easily find how to do things.

I’ve already been doing similar posts with Network Shell Snippets and PowerShell Snippets. The series index will automatically update as posts go live, but if you’re reading a syndicated version, you’ll need to check back to the original post

VBA Snippets
Sleep
Execute URL or Application
Adding an SQL ODBC Connection in Microsoft Dynamics GP
Select Records from Microsoft Dynamics ODBC Connection
Open a File for Appending