Solved

Doclink to other document

Posted on 2004-10-29
359 Views
Last Modified: 2013-12-18
Hello All,
I always have interesting things going on......
Here I'm creating a document that when a submit button is pressed, it takes numerous fields off the document and generates a different document using a different form and then sends an automated email contacting the receiver of the other generated document that one has been created and is pending his review.  In the email Iwant to have a doclink to the new background document created, not the main document.  
Let me give you some business background on this function to clarify.
The main form is a detailed job run documnet that outlines everything you need to know about a particular job.  In this form there are fields outining file specs.  The auto created form creates a file form and sends it to a person that is reponsible for creating the file specs.  so the email needs to doclink to new file form not the main.
hope this makes sense.
Thanks !
Paul
0
Question by:pratigan
    17 Comments
     
    LVL 14

    Expert Comment

    by:p_partha
    You have to use appenddoclink method of notesrichtextitem class
      Call rtitem.AppendDocLink( doc, db.Title )

    doc can be any document(in your case the document created on teh fly)

    Partha
    0
     
    LVL 4

    Author Comment

    by:pratigan
    Hello Partha,
    HOw do I identify my document on the fly ??
    0
     
    LVL 14

    Expert Comment

    by:p_partha
    how are you creating the documnet , it should be in webquerysave or querysave(if it's notes client). In that you will anyways have the handle to the new documnet, use that in your mail memo code

    Partha
    0
     
    LVL 4

    Author Comment

    by:pratigan
    here is the code that creates the "on the fly form"
    Sub Querysave(Source As Notesuidocument, Continue As Variant)
          Dim ss As New notessession
          Dim db As notesdatabase
          Dim ws As New NotesUIWorkspace
          Dim uidoc As notesuidocument
          Dim doc As notesdocument
          Dim backendDoc As NotesDocument
          Set db = ss.CurrentDatabase
          Set uidoc = ws.CurrentDocument
          Set backendDoc = uidoc.Document
          Dim success As Variant
          Dim freqWrd As Variant
          Dim inputbx As Variant
          '************************************************************
          '   Flags set to New .... Create new request forms
          '************************************************************
          If (backendDoc.prod_cklst_mobius_flag(0) = "New" And backendDoc.rpt1(0) <> "" And backendDoc.Status(0) = "Submitted") Then       
                Set doc = db.CreateDocument
                doc.Form = "ORRform"
                doc.ORdate_req_prod = backendDoc.Prod_Dt(0)
                doc.ORrequest = backendDoc.DisplayAuthor(0)
                doc.ORtype = backendDoc.Prod_cklst_mobius_flag(0)
                doc.ORjob_nme = backendDoc.jclmember(0)
                doc.ORappl = backendDoc.Subsystem(0)
                doc.ORdesc = backendDoc.rpt1(0)
                doc.ORrpt = backendDoc.rpt1_rpt_ID(0)
                doc.ORwriter = backendDoc.rpt1_wrtr_nam(0)
                doc.ORfreq = Mid(backendDoc.jclmember(0), 4, 1)
                freqWrd = Mid(backendDoc.jclmember(0), 4, 1)
                
                Dim view As NotesView
                Set view= db.getview("(ORreq)")
                Set vdoc= view.getfirstdocument
                If vdoc Is Nothing Then
                      doc.ORreq= 1
                Else
                      doc.ORreq= vdoc.ORreq(0) + 1
                End If
                
                If freqWrd = "D" Then
                      doc.ORfreq = "Daily"
                Elseif freqWrd = "W" Then
                      doc.ORfreq = "Weekly"
                Elseif freqWrd = "M" Then
                      doc.ORfreq = "Monthly"
                End If
                success = doc.ComputeWithForm( False, False )
                
                If success Then
                      Call doc.Save( True, False )
                      backendDoc.prod_cklst_mobius_flag = ""
                      Call backendDoc.Save(True,False)
                End If
          End If      
    0
     
    LVL 14

    Expert Comment

    by:p_partha
    doc is the new document, send this document as parameter to the mail generation functoin..or paste that function , i will try to help you out

    Partha
    0
     
    LVL 4

    Author Comment

    by:pratigan
    The mail function is initiated when the submit button is pressed.
    Prod_cklst_mobius_flag != "";
    @MailSend("Paul R Ratigan/CIV/CSC"; "";"";"Mobius Rpt Request has been processed and is Pending your Review.";"";"Mobius Request Doc Link =>  "; [IncludeDoclink]);"");
    0
     
    LVL 14

    Expert Comment

    by:p_partha
    @mailsend as far as i know you cannot use any other document link apart from ur current document, so ideally you have to put your mailsend code in lotusscript querysave itself.

    something in this lines:

    declare your doc globally and change your if condition to

     If success Then
                  Call doc.Save( True, False )
    call Processmail(doc)


                  backendDoc.prod_cklst_mobius_flag = ""
                  Call backendDoc.Save(True,False)
             End If


    Add a new function

    function processmail(doclink as notesdocument)
    Dim maildoc As notesdocument
          Set maildoc = db.createdocument
          Dim rtitem As NotesRichTextItem
          Set rtitem = New NotesRichTextItem ( maildoc, "Body" )
          maildoc.form="memo"
          maildoc.sendto = "Paul R Ratigan/CIV/CSC"
    Call rtitem.AppendDocLink ( doclink, "doclink" )
    maildoc.subject = "test"
          Call maildoc.send(False)
    end function
    0
     
    LVL 4

    Author Comment

    by:pratigan
    Helo Partha,
    That's excellent.  I'm coding that in right now and I'll be testing it this morning.  I'll let you know how I make out.
    Thank You !!!
    paul
    0
     
    LVL 4

    Author Comment

    by:pratigan
    Hello Partha,
    I'm gettting an error:  Variant does not contain an object on line:
          Set maildoc = db.createdocument
    0
     
    LVL 14

    Expert Comment

    by:p_partha
    Hey paul
    Make sure db is pointing to the current database, if it is then declare it globally

    Partha
    0
     
    LVL 4

    Author Comment

    by:pratigan
         Set db = ss.CurrentDatabase
    This is setup already in the beginning of the Querysave section.
    0
     
    LVL 14

    Accepted Solution

    by:
    I meant declaration..

    go to form global and there put this line:

      Dim db As notesdatabase

    or u can try this:

    function processmail(doclink as notesdocument)
    dim session as new notessession
    dim db as notesdatabase
    set db = session.currentdatabase
    Dim maildoc As notesdocument
        Set maildoc = db.createdocument
        Dim rtitem As NotesRichTextItem
        Set rtitem = New NotesRichTextItem ( maildoc, "Body" )
        maildoc.form="memo"
        maildoc.sendto = "Paul R Ratigan/CIV/CSC"
    Call rtitem.AppendDocLink ( doclink, "doclink" )
    maildoc.subject = "test"
        Call maildoc.send(False)
    end function
    0
     
    LVL 4

    Author Comment

    by:pratigan
    Hello Partha,
    Got it working..... Excellent.
    Is there a way to have a message before or after the doclink in the body of the email instead of just the actual doclink.  I tried adding this:
          maildoc.body = "Mobius Request Doc Link => "
    to the function to put a message indicating the link but when it generated the email, this message appeared but the doclink was no longer there.???
    Thanks !

    0
     
    LVL 14

    Expert Comment

    by:p_partha
    Call rtitem.Appendtext ("this is just a test message for paul")

    Call rtitem.AppendDocLink ( doclink, "doclink" )

    Partha
    0
     
    LVL 4

    Author Comment

    by:pratigan
    Awesome..... worked like a Charm.  
    Thank you Very Much.
    I totally Appreciate Your Help !!
    0
     
    LVL 14

    Expert Comment

    by:p_partha
    Thx for the points :)

    btw you can even try this:

     Call rtitem.Appendtext ("this is just a test message for paul")
      Call rtitem.AddNewLine( 1 ) ' this is just to add a new line
    Call rtitem.AppendDocLink ( doclink, "doclink" )

    Partha
    0
     
    LVL 4

    Author Comment

    by:pratigan
    Excellenet... That helps make the body neater.
    Thank you !!
    0

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone. Privacy Policy Terms of Use

    Featured Post

    Do You Know the 4 Main Threat Actor Types?

    Do you know the main threat actor types? Most attackers fall into one of four categories, each with their own favored tactics, techniques, and procedures.

    For Desktop Techs: How to retain a user's Notes configuration data when swapping out the end user's computer. (Assuming that you are not upgrading to a completely different version of Notes client) All you need to do is: 1) install Notes o…
      In today’s Arena we can’t imagine our lives without Internet as we are highly used to of it. If we consider our life style just for only 2 min we found that face to face communication is swapped by e-communication.  Every Where from Works place to…
    Migrating to Microsoft Office 365 is becoming increasingly popular for organizations both large and small. If you have made the leap to Microsoft’s cloud platform, you know that you will need to create a corporate email signature for your Office 365…
    In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…

    877 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    11 Experts available now in Live!

    Get 1:1 Help Now