Dynamic Code Blocks

Microsoft Dynamics GP & .NET technical Blog by Tim Wappat

How to bring seasonal joy to your GP users

Seasonal Splash Screen

The network team since I can remember have introduced seasonal splash screens to our Dynamics GP screen through the month of December. Usually with a warm message from the IT team. A couple of years there were 24 different splash screens, each one switched via the login script, one for each day… count down to Christmas!

Below is what you could do, I threw it together as an example, although the ones the team do are far more fun, but it would be unfair to post the images here without permission!

splash1100 Christmas

How is it done?

Essentially if you drop a splash.bmp into the GP application directory, it will be displayed on startup. If no file is present, then an embedded splash screen is shown by default.

You can use a powershell script or batch file at login to switch the bitmaps intelligently as desired.

David Musgrave covers the detail of how to do this in his post Customise the Microsoft Dynamics GP Splash Screen where he also points to GP splash images over the years which is also worth a look.

So give it a go, you can grab the starting bitmap from one of those posts and embellish it as you see fit. Obviously you could be boring and add your support details on there or promote helpdesk open times or whatever!

Happy holidays!

Dynamics GP real time EU tax registration number validation using VIES

Member states of the European Union expose thier VAT (Tax Registration Number) validation to the masses via VIES. Below is an example using Amazon’s VAT registration details against the service on the EU website.



Here the member state to which the organisation belongs has been selected, then the VAT number has been entered allowing for validity check. In the next screen we see the response to clicking the verifty button.


– open data goodness! - now for the cool bit…


If you hunt under the FAQ, buried in there, it turns out there is a SOAP webservice available that does the same thing!


This WSDL URL is our key to some great functionality for Dynamics GP.

In Visual Studio For Dynamics GP Add-in project create a WCF reference to the VIES SOAP webservice.
In your proxy class you will find checkVatPortTypeClient.CheckVat as a method. This is the one we are after, supply the parameters and by reference the results will be returned

. image

We then create a visual studio add in event handler to fire on the user leaving the Tax Registration field of relevant forms in GP. Hence we can validate the VAT number the user has entered! So in our Add in project in the event handler for the options window Tax Registration Field we handle the event.

Public Shared Sub TaxRegNumberValidateBeforeOriginal(Sender As Object, e As System.ComponentModel.CancelEventArgs)
Dim CustomerMaintOptionsForm As MicrosoftDynamicsGpModifiedDictionary.RmCustomerMaintenanceForm.RmCustomerOptionsWindow = _
If Not CustomerMaintOptionsForm.TaxRegistrationNumber.IsEmpty Then
If Windows.Forms.MessageBox.Show("Remember to update address intrastats field too." & vbCrLf & "Do you want to validate this number?", "Validate?", _
Windows.Forms.MessageBoxButtons.YesNo, Windows.Forms.MessageBoxIcon.Question) = Windows.Forms.DialogResult.Yes Then
Using oVATNumberValidationForm As New VATNumberValidation
oVATNumberValidationForm.VatNumber = CustomerMaintOptionsForm.TaxRegistrationNumber.Value
If oVATNumberValidationForm.ShowDialog() = vbOK Then
e.Cancel = True
e.Cancel = True
End If
CustomerMaintOptionsForm.TaxRegistrationNumber.Value = oVATNumberValidationForm.VatNumber
End Using
End If
End If
Catch ex As Exception
Windows.Forms.MessageBox.Show("TaxRegNumberValidateBeforeOriginal" & vbCrLf & ex.ToString)
End Try
End Sub

Using the address of the company being looked up, we select the state code from the combo box (could automate this), we then supply to the webservice on hitting the validate button. A windows form shows the results of the validation to the user. If the supplied details fail validation we show the windows form to the user so they can correct the issue and try again. On closing the form we update the Tax Registration Field.


Private Sub btnValidate_Click(sender As System.Object, e As System.EventArgs) Handles btnValidate.Click
If txtVATNumber.Text.Length > 0 And cbxMemberState.SelectedIndex <> -1 Then
Dim oStringBuilder As New Text.StringBuilder
Dim o As New VATChecker.checkVatPortTypeClient
Dim ovalid As Boolean
Dim oName As String = String.Empty
Dim oAddress As String = String.Empty
Dim oResult As String = String.Empty
Dim oSelectedCountryCode As String = CStr(cbxMemberState.SelectedItem).Split(CChar(("-")))(0)

oResult = o.checkVat(oSelectedCountryCode, txtVATNumber.Text, ovalid, oName, oAddress)
If ovalid Then
txtResults.Text = oStringBuilder.ToString
txtResults.Text = "INVALID"
End If

Windows.Forms.MessageBox.Show("Enter VAT number and select member state")
End If

End Sub


This is a rough example, the webservice call can be asynchronous, the country code derived from addresses, more error checking and neater presentation of the results, window could be derived from Dex windows for familiar Dex styles, however this post is more about what is possible in twenty mins with Dynamics GP plugins and data opened to the world via webservices.

Optionally, if the details of the your company are passed to the service (state & VAT number), then a consultation number is returned which is proof that you have looked up and validated the VAT number should you be challenged on that fact, but this is optional.


Different countries have maintenance windows where this service will not work check the VIES website for details

Task Scheduler and COM automation

Note to self:

The solution for this appalling BUG in Microsoft IIS & Excel is terrific:

  1. Create directory "C:\Windows\SysWOW64\config\systemprofile\Desktop " (for 64 bit Windows) or "C:\Windows\System32\config\systemprofile\Desktop " (for 32 bit Windows)
  2. Set Full control permissions for directory Desktop (for example in Win7 & IIS 7 & DefaultAppPool set permissions for user
    "IIS AppPool\DefaultAppPool")



eConnect: The creator of this fault did not specify a Reason

eConnect WCF exception handling

For this example a WCF service reference to the server endpoint running the GP2010 eConnect integration service as a reference named “GPeConnect” is used.

If an exception were to occur from eConnect on say the CreateEnity mehods, and the exception examined as type system.exception, then the following message is found from ex.message,

System.ServiceModel.FaultException: The creator of this fault did not specify a Reason

To retrieve the error message from econnect that we are interested in, use the System.ServiceModel.FaultException class as shown below. By accessing the Detail.Message property, it is possible to get message of interest.