/ Forums / Advansys Formativ / Creating Solutions with Formativ / BUG: Retreiving the Subject of CurrentItem / Reply To: BUG: Retreiving the Subject of CurrentItem

Support 3

    Unfortunately Token API only return the plain text format of the subject. ItemGetText() token may be working as designed to return the plain text format of the subject, unless Novell decide to update or add another Token API to return RTF format.

    In order to extract the RTF property of the subject, you will need to use the Object API. If you are working with a draft message (which is not yet saved to the message store) then you will need to save the draft message.

    The sample code below save the message to Work-Folder (if the message ID “X00”) then use the Object API to access the RTF property.

    Sub Main(Client, GWEvent)
      dim iWIPFolderPath
      dim oMsg
      dim iMsgID
      dim iWIPPath
      dim iBreakCount
      ' Get the message ID
      iMsgID = GroupWise.ItemMessageIDFromView
      ' If the draft message then save to WIP otherwise access the message
      if (iMsgID = "X00") then
        ' Save the message to WIP
        call GetWIPFolderPath(groupwise.account.workfolder, iWIPPath)
        msgbox "Work In Progress folder path: " & iWIPPath
        Call Groupwise.throwtoken("ItemSaveMessageDraft(""" & iWIPPath & """)", iReturnVal)
        iBreakCount = 0
        while (iMsgID = "Token failed execution!") or (iMsgID = "X00")
           iMsgID = GroupWise.ItemMessageIDFromView
           iBreakCount = iBreakCount + 1
           Utilities.Trace iBreakCount & ": " & iMsgID
           if (iBreakCount > 10) then
             exit sub
           end if
        set oMsg = GroupWise.Account.GetMessage(iMsgID)
        set oMsg =  Client.clientstate.commandmessage
      end if
      msgbox "Subject-Plaintext: " & oMsg.subject.plaintext & vbcrlf &_
      "Subject-RTF: " & oMsg.subject.RTF
    End Sub

    Hope this helps.

    Advansys Support