#6388
Support 1a
Participant

    Please see below some sample applet code that demonstrates one approach to this problem. Copy the source into a new applet in Formativ and integrate it with the Email toolbar. When you open a new email message, a new button will appear on the email view that lets you define whether the email message is official or otherwise. The applet uses a custom field which can be displayed in the GroupWise client. See the comments section at the top of the source code for more information.

    I hope this helps. Please note that this is example code, and does not implement complete error checking, etc.

    Please note that we do offer Formativ development services. If you are interested, please send an email to formativsales@advansyscorp.com for more information.

    Advansys Support

    code:


     '-------------------------------------------------------------------------------
    ' Message Type Selection
    ' Designed By : Formativ Business Solutions Team
    ' Date Created: 4 January 2002
    ' Version 1.0
    '
    ' This applet is a simple demonstration of using a custom field to categorize
    ' existing email messages as either 'Official' or 'Unofficial'. It adds a button
    ' to the GroupWise email. This button displays a dialog that allows the user to
    ' categorize the message as either 'Official' or 'Unofficial'. As all messages
    ' in the account are assumed to be Official by default, data is only stored in
    ' the custom field if the user designates the message as unofficial.
    '
    ' You can see the state of messages by adding the "ADV Official Status" custom
    ' field to the mail list column header in the client. Those messages that have
    ' not yet been categorized will have no text appear in the display. Those that
    ' have been designated as unofficial will have the word "Unofficial" appear.
    '
    ' You can easily search for unoffical messages by using the standard GroupWise
    ' Find facility, using the Advanced find option.
    '
    ' You may need to restart the client the very first you execute the applet in
    ' order to see the newly created custom field
    '
    ' INTEGRATIONS: This applet has already been integrated with the email view, but
    ' the integration has been disabled. Enable it in the Integrations tab in
    ' Formativ Admin
    '-------------------------------------------------------------------------------

    Dim Dlg
    Dim RadioCtl
    Const cSelectType = 101
    Const CUSTOM_FIELD = "ADV Official Status"
    Const CAPTION = "Formativ Applet Examples"


    '-------------------------------------------------------------------------------
    ' Main Line Processing
    '-------------------------------------------------------------------------------
    Sub Main(Client, GWEvent)

    Dim Msg
    Dim Cmd
    Dim sIndex
    Dim Fields
    Dim fieldObj

    ' Set the default radio button to Unofficial
    sIndex = 0

    Set Msg = Client.ClientState.CommandMessage

    ' Add the custom field in GroupWise field definitions
    AddField
    Set Fields = Msg.Fields

    On Error Resume Next
    Set fieldObj = Fields.Item(CUSTOM_FIELD, fgwString)

    ' If the field exists then we check the value
    If IsObject(fieldObj) Then
    If fieldObj.Value = "Unofficial" Then
    sIndex = 1
    Else
    sIndex = 0
    End If
    End If

    ' Display the selection dialog
    SetupDlg(sIndex)
    Select Case Dlg.Execute
    Case Btn1 Cmd = cSelectType
    End Select

    ' Change the status based on the type selected
    If Cmd = cSelectType Then
    Select Case RadioCtl.ItemIndex
    Case 0 Call Fields.Add(CUSTOM_FIELD, fgwString, " ")
    Case 1 Call Fields.Add(CUSTOM_FIELD, fgwString, "Unofficial")
    End Select
    End If

    GroupWise.Account.Refresh

    Set Msg = Nothing
    Set Fields = Nothing
    Set fieldObj = Nothing

    End Sub


    '-------------------------------------------------------------------------------
    ' Add the custom field in field GroupWise definitions
    '-------------------------------------------------------------------------------
    Sub AddField

    Dim FieldObj
    Dim FieldDefs

    Set FieldDefs = GroupWise.Account.FieldDefinitions
    On Error Resume Next
    Set FieldObj = FieldDefs.Item(CUSTOM_FIELD, fgwString)

    ' If the custom field does not exists in the field definitions add the field.
    If FieldObj Is Nothing Then
    Call FieldDefs.Add(CUSTOM_FIELD, fgwString)
    GroupWise.Account.Refresh
    End If

    Set FieldDefs = Nothing
    Set FieldDefs = Nothing

    End Sub


    '-------------------------------------------------------------------------------
    ' Dialog to select whether the mail is Official/Unofficial
    '-------------------------------------------------------------------------------
    Function SetupDlg(sIndex)

    Set Dlg = Utilities.NewControlBoxDialog
    With Dlg
    .Height = 215
    .Caption = CAPTION
    .Title = "Select the email type"
    End With

    Set RadioCtl = Dlg.AddRadioGroupControl
    With RadioCtl
    .Caption = "Is this Official/Unofficial mail?"
    .Items.Add("Official Mail")
    .Items.Add("Unofficial Mail")
    .ItemIndex = sIndex
    .Height = 70
    .Columns = 2
    .Hint = "Select message type"
    End With

    End Function