Page 1 of 1

Interacting with Remedy AR System DiaryFields Rate Topic: -----

#1 Sethro117  Icon User is offline

  • Still the sexiest mofo.
  • member icon

Reputation: 236
  • View blog
  • Posts: 2,378
  • Joined: 14-January 09

Posted 20 May 2010 - 12:59 PM

Interacting with Remedy AR System DiaryFields
By: Seth Hall


For those who have followed the other tutorials with Remedy AR System you notice that I never messed with DiaryFields. I finally got some time in to play around with them and decided to share it with you. If you havenít followed my other tutorials then you will need to go back to those to fully establish a solid Remedy connection to your application.

The first part of this tutorial is a Console Application which retrieves the number of Diary entries, last modified by, etc. The last part will show you how to actually add information to those DiaryFields.

Imports BMC
Module Test
    Public Class GetDiary
        ' Server info

        Shared servername As String = "REMOVED"
        Shared username As String = "REMOVED"
        Shared password As String = "REMOVED"
        ' This is the field ID that you want to get the information from
        Shared EntryID As String = "000000058134285"
        Shared DiaryFieldID As UInteger = 536870967
        Shared Form As String = "ISD"
        '
        Shared Server As New ARSystem.Server

        Shared Sub Main()
            Ď Try logging  in to the Remedy Server to pull the info. Remember your Field IDs and Form names will vary and             Ď you should contact your Remedy Admin for any questions regarding your environment.
Try
                Login()
                Dim IDS() As UInteger = {1, 5, DiaryFieldID}
                Dim record As ARSystem.FieldValueList = Server.GetEntry(Form, EntryID, IDS)
                If Not IsDBNull(record.Item(1)) Then
                    Console.WriteLine("Retrieved record no: " & CType(record.Item(1), String))
                End If
                If Not IsDBNull(record.Item(5)) Then
                    Console.WriteLine("Record was last modified by: " & CType(record.Item(5), String))
                End If
                Ď Get Diary Field
                If Not IsDBNull(record.Item(DiaryFieldID)) Then
                    Dim Diary As ARSystem.DiaryList = CType(record.Item(DiaryFieldID), ARSystem.DiaryList)
                    Console.WriteLine(Diary.Count & " Diary entries found." & vbNewLine & vbNewLine)
                    For Each Entry As ARSystem.DiaryEntry In Diary
                        Console.Write(Entry.User & " - ")
                        Console.WriteLine(Entry.Time)
                        Console.WriteLine(Entry.Text)
                    Next
                End If

            Catch ex As System.Exception
                Console.Write("ERROR: " & ex.Message)
            Finally
                Logout()
            End Try
            Console.ReadLine()
        End Sub

        Public Shared Sub Login()
            Try
                Server.Login(servername, username, password, "", 24341)
                Dim UI() As ARSystem.UserInfo = Server.GetListUser(ARSystem.Server.UserListType.Myself, New Date(2000, 1, 1))
            Catch ex As Exception
                Throw New System.Exception(ex.Message, ex.InnerException)
                Exit Sub
            End Try
        End Sub


        Public Shared Sub Logout()
            Server.Logout()
        End Sub
    End Class
End Module



For the second part we will actually connect and be able to update a DiaryField on a help ticket. For this since we donít need to keep a constant connection to the Remedy Server, I have declared it to just Login once, post the information then it will logout.

Imports BMC
Public Class Form1
    Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
     Ď Declare our variables for our environment
        Dim username As String = "REMOVED"
        Dim password As String = "REMOVED"
        Dim Fields As New ARSystem.FieldValueList
        Dim entryID As New ARSystem.EntryListFieldList
        Dim form As String = "ISD"
        Dim ARServer As New ARSystem.Server
       Ď Login to Remedy Server
        ARServer.Login("SERVERNAME", username, password, "", PORTNUMBER)
        Ď Here we add the LOG field(10) which is a DiaryField and set what we want to write to it.
        Fields.Add(10, "Dashboard Automation Test - " & Now())
        Dim record As New ARSystem.FieldValueList
         Ď Update Diary Field
        ARServer.SetEntry("ISD", "TICKETNUMBER", Fields)
    End Sub

End Class



Thatís all. Iíve added link to the past two tutorials which will get you started connecting and creating tickets with the Remedy AR System. If you have any questions or would like to request a tutorial just leave a comment.

Connecting to Remedy AR System with .NET API
Creating Tickets with Remedy AR System

Is This A Good Question/Topic? 0
  • +

Replies To: Interacting with Remedy AR System DiaryFields

#2 Guest_Lawrence*


Reputation:

Posted 28 July 2010 - 08:24 AM

Sethro117,

I am trying to view your other tutorials on Remedy. The following link is not working:
Connecting to Remedy AR System with .NET API.

I am trying to create a Crystal report application and need to be able to set the Crystal Report's Connection String. Would this be something you could dive into in the future?

Thanks
Was This Post Helpful? 0

Page 1 of 1