/ Forums / Advansys Formativ / Creating Solutions with Formativ / Routing Slips & Attachments

  • Creator
    Topic
  • #4219
    sfritz
    Participant

      Hi There,
      I am a newbie to writing formativ applets and find it to an excellent form design tool. I am cloning code used in creating a routing slip in one of the examples provided by Advansys. The routing slip information is being built properly based on the user input via a form which also includes an opportunity to attach files using the using TOpenDialog. The mail message is successfully sent and when the mail message arrives I see the attachment icon associated with the message. Here lies the problem I open the message using the Routing Mail message example, the attachment is not accessible. I realize the code in the Routing Mail message example does provide a method of view attachments, is this easily achieved and if so how? To further complicate the matter I was hoping to have the attachments continue to be routed with the message until the routing slip is complete.

      I hope this makes senses. I have been attempting to add code to add a custom field to hold the attachment files but with little success. Any advice on this matter would be greatly appreciated.

    • Author
      Replies
    • #7516
      Support 3
      Participant

        Hi,

        The Routing Mail message example does not support attachments. If you are updating the solution to support attachments then refer to the Object API documentation, specially the Message, Attachments and Attachment object. See below the sample code to add and view attachments.

        Add a file type attachment…

        Message.Attachments.Add(“c:temptest.txt”, egwFile, “”)

        View available attachments…

        for each attachment in oMsg.attachments
        msgbox attachment.displayname
        next

        quote:


        I have been attempting to add code to add a custom field to hold the attachment files but with little success. Any advice on this matter would be greatly appreciated.


        I am not sure why you want to add the attachment files to custom field. I think you should use the Message.Attachments collection to manage the attachments. The sample code below add a custom field to a message.

        ———————–
        on error resume next

        ‘ Get the selected message object.
        set oMsg = nothing
        set oMsg = Client.clientstate.commandmessage
        if oMsg is nothing then
        exit sub
        end if

        ‘ Make sure the field definition exists in the account. Add the field definition if
        ‘ not exists. You may need to restart the GroupWise client to refresh the field definitions
        ‘ collection.
        set oFieldDef = nothing
        Set oFieldDef = GroupWise.Account.FieldDefinitions.Item(“Field Name”, fgwString)

        if oFieldDef is nothing then
        Set oFieldDef = GroupWise.Account.FieldDefinitions.Add(“Field Name”, fgwString)
        end if

        ‘ Add the field into message fields collection
        call oMsg.Fields.Add(“Field Name”, fgwString, “c:temptest.txt”)

        set oMsg = nothing
        set oFieldDef= nothing
        ———————–

        Hope this helps.

        Regards,
        Advansys Support

        #7518
        sfritz
        Participant

          Hi,

          First of all thank you for responding to my query. I am sorry it has taken me so long to reply to your coding suggestions. In the routing message dialog as you suggested I am using the attachment collection.

          Code:

          Using TOpenFileDialog I obtain the filename
          Set NewMsg = GroupWise.Account.MailBox.Messages.Add
          call NewMsg.Attachments.Add(WSFORM.Attachments.FileName, egwFile,””)

          I am successful in sending a single file only, I am not certain as to why I cannot send multiple files however, I first need to be able to see the file attachment I am sending in the routing mail message example.

          The function I defined in the Routing Mail Message Example is shown below:

          Function DisplayAttach

          dim oMsg

          set oMsg = Client.ClientState.CommandMessage
          for each attachment in oMsg.Attachments
          msgbox oMsg.Attachments.FileName
          next

          set oMsg = nothing

          End Function

          I have tried defining a button in the routing mail message intro dialog and associating it to the function but with no success. I have tried just calling the function with no success. The first step is to get the message box to appear with the file name but ultimately I would like to view the attachments within a routed mail message and send the files onto the next recipient, or for a newbie this is far to complex? I have read the suggested readings for Object API and it is very obvious that I have missed something BIG!

          Hopefully this makes sense and I appreciate your help and time on this matter.

          #7517
          Support 3
          Participant

            quote:


            Originally posted by sfritz:
            I am successful in sending a single file only, I am not certain as to why I cannot send multiple files however, I first need to be able to see the file attachment I am sending in the routing mail message example.


            I am not sure why you can not attach multiple files. The code below successfully adds two files as attachments…

              
            Set oMsg = GroupWise.Account.workfolder.Messages.Add 
            call oMsg.Attachments.Add("c:tempfile1.txt", egwFile,"")
            call oMsg.Attachments.Add("c:tempfile2.txt", egwFile,"")
            

            quote:


            The function I defined in the Routing Mail Message Example is shown below:

            Function DisplayAttach

            dim oMsg

            set oMsg = Client.ClientState.CommandMessage
            for each attachment in oMsg.Attachments
            msgbox oMsg.Attachments.FileName
            next


            The above code display the selected message’s attachments file name. Make sure you have the correct message selected in GroupWise client.

            quote:


            I would like to view the attachments within a routed mail message and send the files onto the next recipient, or for a newbie this is far to complex?


            I think the ‘Routing Mail Message’ applet is bit complex for the newbie. I will recommend you to see the GroupWise object API, GroupWise Token API, Formativ language Guide, Formativ Developers Guide then look at the simple formativ example applets.

            Hope this helps.

            Regards,
            Advansys Support

          Viewing 3 replies - 1 through 3 (of 3 total)
          • You must be logged in to reply to this topic.