• Can we add a redirect?

    By Joe Wichowski 2 decades ago

    Normally, when creating a C&S application, we send the mailbox the meeting "stub" so that they can approve the meeting or to-do and add it to their calendar. After that, however, it is no longer "linked". When you open the local calendar, you see the meeting or to-do, but the date/time or evern information may have changed since created.



    It would be great to have a "redirect" function. So, when we open the local activity, it actually takes us to the C&S application instead of showing the local mailbox data.



    The fields I am using in my templates is as follows:



    1) Adding 4 fields when I create the local activity using LotusScript - RedirectServer, RedirectDB, RedirectDocID, RedirectURL


    • RedirectServer - the server name
    • RedirectDB - the database path/filename or the replica id
    • RedirectDocID - the document UniversalID
    • RedirectURL - the web page to navigate to (if it is a web-app instead of a Notes app)



      Basically, the PostOpen would check these fields, and if they exist, it would close the window and redirect to the appropriate document/web page.



      The code is as follows (not tested, but it should mostly work):



      Sub Postopen(Source As Notesuidocument)

      dim session as New NotesSession

      dim workspace as New NotesUIWorkspace



      'check for redirect

      If source.Document.RedirectDB(0) <> "" then

      'see if we can navigate to linked document

      set redirectDB = session.GetDatabase(source.Document.RedirectServer(0), source.Document.RedirectDB(0))

      If redirectDB.IsOpen then

      set redirectDoc = redirectDB.GetDocumentByUNID(source.Document.RedirectDocID(0))

      else

      'see if it is a replica id instead
      dim redirectDB as New NotesDatabase<br/>
      if redirectDB.OpenByReplicaID(source.Document.RedirectServer(0), source.Document.RedirectDB(0)) then<br/>
        set redirectDoc = redirectDB.GetDocumentByUNID(source.Document.RedirectDocID(0))          <br/>
      end if<br/>
      
      end if

      'now open document if it is not nothing

      if not redirectDoc is nothing then

      source.Close true

      call workspace.EditDocument(true, redirectDoc, false)

      end if



      elseif source.Document.RedirectURL(0) <> "" then

      'openurl

      source.Close true

      Call Workspace.URLOpen(source.Document.RedirectURL(0))

      end if

      End Sub