|Theme: Cool Tech Tips|
Action Request System .NET and COM API
This Tips and Tricks article is Part 2 in a 2-part series on the Action Request System .NET and COM API. Part 1 gave an overview of this AR System add-on, which is freely available from Community Downloads on the AR System Developer Community. This article will provide examples of the AR System .NET and COM API in action.
Several examples are included in the distribution, and installed into the AR System .NET and COM Samples folder. These include examples of integration from Microsoft Excel using VB macros, integration from Active Server Pages using both JScript and VBScript, and integration from a Windows Forms .NET application developed in C#. In the future, examples of Visual Basic .NET will be added that included ASP.NET Web pages, as well as custom Web Services.
The included Microsoft Excel sample demonstrates integration with AR System from Excel macros written in VBA. It demonstrates usage of ARSystem.Server.GetEntryStatistics, and will retrieve the number of entries with each status value for any form on an AR System Server.
Note: Click images for full screen view.
Figure 1 - Screenshot of the sample Excel integration
Also included is a sample Active Server Pages application with pages developed in both JScript and VBScript. The sample demonstrates listing the forms and fields on a server, as well as performing arbitrary searches against any form and returning any set of fields.
Figure 2 ? Screenshot of webpage utilizing the Active Server Pages integration
Another of the installed sample applications is the Field Label Changer. This is a C# application using Windows Forms, which provides the ability to edit field labels an any form and view in a DataGrid control. Complete source code is included ? it may be hard to believe, but the entire integration with AR System is only about 30 lines of code!
Figure 3 - Screenshot of the Field Label Changer application created in C#
The Action Request System .NET and COM API is available today in the AR System Developer Community. Select Community Downloads in the left side navigation, enter your Single Sign On (or create one), and search for Utility under the Development category.
As mentioned in Part 1, like the Remedy Java API, the .NET and COM API is a wrapper of the C API. However, unlike the Java API, this API is not yet a complete wrapper. It is designed to meet nearly all integration needs. The set of API functionality provided is quite complete for data-related tasks (CreateEntry, SetEntry, GetEntry, DeleteEntry, GetListEntry, GetMultipleEntries, GetListEntryWithFields, GetListSQL, GetEntryStatistics, GetEntryBLOB, MergeEntry, and ImportARXData), as well as Field definitions (GetField, SetField, CreateField), GetServerInfo and GetServerStatistics, and Import/Export of definitions. See the documentation for a complete list of implemented methods.
In addition, this API is not officially supported at this time by Remedy. Support is generally provided by myself, and new versions with enhancements are uploaded to the Developer Community quite frequently.
For those familiar with the C or Java AR System APIs, the biggest change you will see is the lack of a Value class. For simplicity, all values in the .NET API simply use the native type wherever possible. If there is no native type that corresponds to the AR System datatype, a class is provided for that type (e.g. ARSystem.Attachment). System.DBNull.Value is used for null values. In addition, field value collections are implemented using a dictionary for simplicity and lookup performance. To assign values to fields, simply do this:
ARSystem.FieldValueList values = new ARSystem.FieldValueList();
values = ?text value?; // assigns a text (AR_DATA_TYPE_CHAR) value
values = 150.50m; // assigns a decimal (AR_DATA_TYPE_DECIMAL) vaiue
values = System.DBNull.Value; // assigns AR_DATA_TYPE_NULL
values = System.DateTime.Now.ToUniversalTime(); //AR_DATA_TYPE_TIME
This API makes use of the uint System.Type for compatibility with the AR System C API. This type is better supported by C# and JScript than by VB.NET or VBScript. In VB.NET, you will need to call System.Convert.ToUInt32 to pass a uint for field ids, and in VBScript you will need to use CLng() to print out field ids, as in the code samples in the documentation. In addition, VTBL binding to the COM API is not supported.
Principal Product Developer, Remedy Product Development
Joined Remedy 1994
Action Request System .NET and COM API