6 Replies Latest reply: Feb 6, 2012 4:44 PM by Omar Palaming RSS

Remedy diary fields

PJWigglesniff

Can anyone tell me how to interface with Remedy's diary fields through the API? I'm trying to display and insert into a diary field from a web interface and I'm looking to see if anyone has any pointers.

  • 1. Re: Remedy diary fields
    Misi Mladoniczky

    Hi PJWigglesniff,

    When retrieving diary data, you will get a character string with delimiters between records and the different field.

    The fields in each record are the User, the TimeStamp and the text Value of the entry.

    This is data from an exported ARX-file with two entries.
    - Timestamp is 1190102415 and 1190102416
    - User is "miz"
    - Value is "xxx" and "yyy" in the two records.

    DATA "1190102415DmizDxxxC1190102416DmizDyyyC"

    - The delimiter after each record is 0x03 (C above)<br />- The delimiter between the fields is 0x04 (D above)

    Use the ARGetEntry() call to get the data of the field.

    Use the ARDecodeDirary() call to convert the DIARY-DATA into an ARDiaryList which can be manipulated. This will handle the delimiters for you.

    Use the AREncodeDiary() call to convert your changed DIARY-DATA back into
    something that can be written back to the server.

    Use the ARMergeEntry() call to import the changes back into the server.

    The ARMergeEntry() requires that you have ADMIN privileges. The reason is that editing a Diary-field is not considered something that should be done by ordinary users.

    To add data to the end of a diary, you can use the ARSetEntry() call instead.

    You can do this the database level as well I guess.

    Other ports of the API besides C has similar functions for decoding/encoding the diary data.

    Another approach which I often use is to skip the diary-field and create a diary-form instead. You can then have a table-field to show diary data. This has many advantages for reporting and statistical purposes, as well as the possibility to change/delete/insert records when needed.

    I have published a free too called RRR|DiaryX to help you convert your current diary-data into a diary-form. It can also be used to extract some interesting statistics that may be hidden within your current diary-data.

            Best Regards - Misi, RRR AB, http://rrr.se

  • 2. Re: Remedy diary fields
    Appajee Papolu

    In addition to Misi already noted, following may be helpful if you&#39;re looking for Java or .NET APIs...
     
    Both these APIs have easier way to access diary field data. There is a DiaryListValue in .NET which is what you'll get when you do a GetEntry. This class is a list of Diary items, with getters for user, time stamp, and text value. Thus you can easily iterate diary fields content. In Java API as well, you have similar thing (slightly different names, but same basic deal).

    If you want to "append new diary entry", which IMO is the most common scenario, you simply supply string value for the diary field -- either using append method on DiaryListValue field & assigning this value to the field; (OR), simply supply a string value. Finally call SetEntry method. The supplied text will become a newly added diary item's text with the currently login user as the User value & current time stamp.  

    Finally if you want to change the entire diary field value, you can use MergeEntry API method as Misi noted. But use this sparingly when you have a good use case to do so - as incorrect usage may leave you with corrupted or lost diary data.

    regards
    Appajee

  • 3. Re: Remedy diary fields
    rcw70

    Do you have a working example of code in COM, .net or Java to retrieve DiaryEntry objects from DiaryLists/DiaryFields? I am banging my head against the wall trying to instantiate a DiaryList that is not empty (I&#39;m trying to do it in VB6/COM). I can instantiate any other date type just fine, but no matter what method I use to instantiate the entry/field for Diary fields I get an empty ChangeDiary object.

  • 4. Remedy diary fields
    Omar Palaming

    try
    {
    for (int i = Notes.decode(aRServerUser.encodeDiary(Notes)).size() – 1; i > -1; i–)
    {
    log.debug(i + “.) DiaryInfo()====” + Notes.decode(aRServerUser.encodeDiary(Notes)).get(i).getText() + “=====”);
    log.debug(i + “.)TimeStamp()====” + Notes.decode(aRServerUser.encodeDiary(Notes)).get(i).getTimestamp() + “=====”);
    }
    }
    catch (Exception ex)
    {
    log.debug(“=====” + ex.getMessage() + “=====”);
    }

     

    It will display all Diary Item from Latest to Oldest.

    NOTE: Notes is of DiaryListValue Type.

  • 5. Re: Remedy diary fields
    Aaron NameToUpdate

    I could not get this to work in Java.  Do you have a larger code sample that this is from?  How do you get from the Entry object to the DiaryListValue object in the first place?

  • 6. Re: Remedy diary fields
    Omar Palaming

    Make sure that you are already login to your AR Server.