ARTICLE

Great Plains Dexterity programming secrets – Tips for developers

Posted by Andrew Karasev Articles | Visual Basic 2010 July 26, 2004
This article is for advanced Great Plains Dexterity and VS.NET developers. It describes the technique of direct COM objects calling in Dexterity.
 
Reader Level:

This article is for advanced Great Plains Dexterity and VB.Net developers. It describes the technique of direct COM objects calling in Dexterity.

Introduction

Microsoft Great Plains and its current programming language Dexterity should be considered seriously by developers community and we would like to popularize the advanced techniques in Dexterity - calling COM objects. This will enable you as a developer to integrate such nice things as Web Service into legacy Great Plains interface.

First of all - you need to create your Web Service at your choice - it is outside of the scope here - we have WildCardWebService created. Then you need to create COM object. We used VB.Net and Visual Studio.Net 2003.

Public Class AST_ComWildCard
#
Region "COM GUIDs"
' These GUIDs provide the COM identity for this class
' and its COM interfaces. If you change them, existing
' clients will no longer be able to access the class.
Public Const ClassId As String = "E14B960C-780C-45B4-92BD-4E8EB228AFC3"
Public Const InterfaceId As String = "7C2C2917-43D0-4BE1-B16B-1473E8A40BDC"
Public Const EventsId As String = "8BE33DF4-D64D-4A54-BEA7-EFD645D205D6"
#
End Region
' A creatable COM class must have a Public Sub New()
' with no parameters, otherwise, the class will not be
' registered in the COM registry and cannot be created
' via CreateObject.
Public Sub New()
MyBase.New()
End Sub
Public Function LoadActivate(ByVal localurl As String, ByVal baseurl As String, _
ByVal userid As String, ByVal pwd As String, _
ByVal sourceid As String, _
ByVal cardnum As String, ByVal subprogid As String, ByVal LoadAmount As String, _
ByRef response As String, ByRef Description As String) As String
Dim result As String
Try
Dim ws As WildCardWebService
ws =
New WildCardWebService(localurl)
result = ws.LoadActivate(baseurl, userid, pwd, sourceid, cardnum, subprogid, LoadAmount)
If result = "URL doesn't respond!" Then
response = "2"
Description = result
Return result
End If
If result.IndexOf("Response=") <> 0 Then
response = result.Substring(result.IndexOf("Response=") + 9 + 1, 1)
End If
If result.IndexOf("ErrorDescription=") <> 0 Then
Description = result.Substring(result.IndexOf("ErrorDescription=") + 17 + 1,
esult.IndexOf(" ErrorDisplay") - 1 - (result.IndexOf("ErrorDescription=") + 17 + 1))

End
If
Return result
Catch ex As Exception
response = "3"
Description = "COM Object Error!"
result = ex.Message.ToString()
Return result
End Try
End Function
End
Class

Please - register this COM object via REGASM command.

Now let's open Dexterity. If you don't have it installed - install it from Great Plains 7.5 or 8.0 CD#2.

In Dexterity open DYNAMICS.DIC and create new Library: Resource Explorer->New->Library(COM), select your COM object and register. Now it is ready for referencing in the Sanscript code.

Create Custom Form/Window, create local invisible field '(L) WildCard' this field should have reference type COM Object and COM Object type will be available from the list. Place push button which will be calling your COM/Web Service and add somewhat similar to this code for the button:

'(L) WildCard' of window AST_WildCard = COM_CreateObject("WildCardClassLibrary.AST_ComWildCard");
if '(L) WildCard' of window AST_WildCard = null then
error "Could not create WildCardClassLibrary object.";
abort script;
end if;

'(L) Result' of window AST_WildCard = '(L) WildCard' of window AST_WildCard.LoadActivate(
"
http://localhost/wildcardwebservice/wildcardwebservice.asmx",
"
https://yourasppage.asp",
"PARAMETER1",
"PARAMETER2",
"PARAMETER3",
"PARAMETER4",
"PARAMETER5",
"PARAMETER6");

'(L) WildCard' of window AST_WildCard = null;

And you are done. You are now calling from Custom Dexterity window COM and it in turn calls web service. Web service returns parameters back to COM and you are getting them back in your good-old-days Dexterity customization.

share this article :
post comment
 
6 Months Free & No Setup Fees ASP.NET Hosting!
Become a Sponsor
PREMIUM SPONSORS
  • Finally – a virtual platform that delivers next-generation Windows Server 2008 Hyper-V virtualization technology from a managed hosting partner you can truly depend on. Visit www.maximumasp.com/max for a FREE 30 day trial. Hurry offer ends soon. Climb aboard the MaxV platform and take advantage of High Availability, Intelligent Monitoring, Recurrent Backups, and Scalability – with no hassle or hidden fees. As a managed hosting partner focused solely on Microsoft technologies since 2000, MaximumASP is uniquely qualified to provide the superior support that our business is built on. Unparalleled expertise with Microsoft technologies lead to working directly with Microsoft as first to offer IIS 7 and SQL 2008 betas in a hosted environment; partnering in the Go Live Program for Hyper-V; and product co-launches built on WS 2008 with Hyper-V technology.
    Get 2 Months Free of ASP.NET Hosting for Only $4.95/month! Receive FREE MS SQL and MySQL Databases Including ASP.NET 4/3.5, MVC 3.0, Silverlight 4, Windows 2008/IIS 7.0 Plus FREE IIS 7 Modules. Host UNLIMITED ASP.NET Web Sites - Click Here!
Team Foundation Server Hosting
Become a Sponsor