[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 355
  • Last Modified:

Sending a email with a doc link

I have a main form and in this form I have a send email button.  This action sends out emails to whom ever is in the SendTo.  They click the document in the inbox and it takes them to a form to forward or reply.  All responses are stored within the first form, so it shows all the response documents in the first form.  This works great.  

The problem is when they get the email in the thier inbox - it is a minuium 80k  if there are attachments it can get up to 400k or more.  There is a size limit on our inboxes here.  Is there a way that this send mail action can just send the subject, message and a link to that document.  So the user can copen in the mail click the link and be at that same place they were if they had open the mail like it works today.  

Here is the send mail action script

Sub Click(Source As Button)
      Dim ws As New NotesUIWorkspace
      Dim session As New NotesSession
      Dim db As NotesDatabase
      Dim uiDoc As NotesUIDocument
      Dim doc As NotesDocument
      Dim mDoc As NotesDocument
      
      Set uiDoc = ws.CurrentDocument
      Call uiDoc.Save
      Set doc = uiDoc.Document
      Set db = session.CurrentDatabase
      Set mDoc = New NotesDocument(db)
      If doc.NagMail(0) = "Yes" Then
            Set item = Doc.ReplaceItemValue("NagList", Doc.SendTo)
      End If
      If doc.ViewBy(0) = "Viewing Restricted (To: Recipients Only)" Then
            Set item= Doc.ReplaceItemValue("DocReaders", Doc.SendTo)
            Call item.AppendToTextList(session.UserName)
      End If
      
      doc.CreateFlag = No      
      'Set db = session.CurrentDatabase
      'Set mDoc = New NotesDocument(db)
      
      Call doc.CopyAllItems(mDoc)      
      If doc.ViewBy(0) = "No Restrictions (All)" Then
            Set item = mDoc.GetFirstItem("DocReaders")
            Call item.AppendToTextList(mDoc.SendTo)
            Call item.AppendToTextList(session.UserName)
      End If
      
      mDoc.Form = "Outgoing Request Form"
      mDoc.SourceDocument = doc.UniversalID
      mDoc.SenderList = session.CommonUserName      
      Call mDoc.Send(True)
      Call uiDoc.Close(True)
      
End Sub
0
Jaziar
Asked:
Jaziar
  • 8
  • 3
  • 2
1 Solution
 
Sjef BosmanGroupware ConsultantCommented:
Yes you can send doclinks, but only to other Notes users. Use the AppendDocLink-method in a RichText-item.

Sub Click(Source As Button)
     Dim ws As New NotesUIWorkspace
     Dim session As New NotesSession
     Dim db As NotesDatabase
     Dim uiDoc As NotesUIDocument
     Dim doc As NotesDocument
     Dim mDoc As NotesDocument
     
     Set uiDoc = ws.CurrentDocument
     Call uiDoc.Save
     Set doc = uiDoc.Document
     Set db = session.CurrentDatabase
     Set mDoc = New NotesDocument(db)
     If doc.NagMail(0) = "Yes" Then
          Set item = Doc.ReplaceItemValue("NagList", Doc.SendTo)
     End If
     If doc.ViewBy(0) = "Viewing Restricted (To: Recipients Only)" Then
          Set item= Doc.ReplaceItemValue("DocReaders", Doc.SendTo)
          Call item.AppendToTextList(session.UserName)
     End If
     
     doc.CreateFlag = No     ''' ?????
     'Set db = session.CurrentDatabase
     'Set mDoc = New NotesDocument(db)
     
'     Call doc.CopyAllItems(mDoc)    
'     If doc.ViewBy(0) = "No Restrictions (All)" Then
'          Set item = mDoc.GetFirstItem("DocReaders")
'          Call item.AppendToTextList(mDoc.SendTo)
'          Call item.AppendToTextList(session.UserName)
'     End If
     
'     mDoc.Form = "Outgoing Request Form"
'     mDoc.SourceDocument = doc.UniversalID
'     mDoc.SenderList = session.CommonUserName    

    mdoc.Form= "Memo"
    Set rtitem= New NotesRichTextItem(mdoc, "Body")
    Call rtitem.AppendText("Below you will find a link to a New request ...")
    Call rtitem.AddNewline(2)
    Call rtitem.AppendDocLink(doc, "Request")
    mdoc.Subject= "New request"
     Call mDoc.Send(True)
     Call uiDoc.Close(True)
End Sub
0
 
JaziarAuthor Commented:
I am sorry I was wrong - the link needs to take the user to the "Outgoing Request Form" not back to the first form - is this possible?
0
 
JaziarAuthor Commented:
Call rtitem.AppendDocLink(doc, "Request")

I changed to

Call rtitem.AppendDocLink(doc, "Outgoing Request Form")

but it still takes me to the Request Form
0
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

 
Sjef BosmanGroupware ConsultantCommented:
You could do that, but then you'd have to save that document in the database first. I think you can combine your code an mine easily, just change some names (you need to have 1 NotesDocument for the Outgoing Request, and 1 for the mail).
0
 
JaziarAuthor Commented:
My LotusScript is very poor I am afraid.  Here is what I tried to do
Added rDoc
Sub Click(Source As Button)
      Dim ws As New NotesUIWorkspace
      Dim session As New NotesSession
      Dim db As NotesDatabase
      Dim uiDoc As NotesUIDocument
      Dim doc As NotesDocument
      Dim mDoc As NotesDocument
Add-> Dim rDoc As NotesDocument
      
      Set uiDoc = ws.CurrentDocument
      Call uiDoc.Save
      Set doc = uiDoc.Document
      Set db = session.CurrentDatabase
      Set mDoc = New NotesDocument(db)
Add-> Set rDoc = New NotesDocument(db)      
      
      If doc.NagMail(0) = "Yes" Then
            Set item = Doc.ReplaceItemValue("NagList", Doc.SendTo)
      End If
      If doc.ViewBy(0) = "Viewing Restricted (To: Recipients Only)" Then
            Set item= Doc.ReplaceItemValue("DocReaders", Doc.SendTo)
            Call item.AppendToTextList(session.UserName)
      End If
      
      doc.CreateFlag = No     ''' ?????
      Set db = session.CurrentDatabase
     'Set mDoc = New NotesDocument(db)
Add->      Call doc.CopyAllItems(rDoc)
      Call doc.CopyAllItems(mDoc)    
      If doc.ViewBy(0) = "No Restrictions (All)" Then
            Set item = mDoc.GetFirstItem("DocReaders")
            Call item.AppendToTextList(mDoc.SendTo)
            Call item.AppendToTextList(session.UserName)
      End If
Added->      Call uiDoc.Save
Changed->rDoc.Form = "Outgoing Request Form"
Changed->rDoc.SourceDocument = doc.UniversalID
Changed->rDoc.SenderList = session.CommonUserName    
      
      mdoc.Form= "Memo"
      Set rtitem= New NotesRichTextItem(mdoc, "Body")
      Call rtitem.AppendText("Below you will find a link to a New request ...")
      Call rtitem.AddNewline(2)
Changed->Call rtitem.AppendDocLink(rDoc, "Outgoing Request Form")
      mdoc.Subject= "New request"
      Call mDoc.Send(True)
      Call uiDoc.Close(True)
End Sub

WHen I get the mail and click the link it errors -> Linked Document Not in View
0
 
Sjef BosmanGroupware ConsultantCommented:
Good show. Not bad at all!

There are a few questions that I have:
- you set doc.CreateFlag= No
  is there a global variable defined with the name No?
- you set db= session.currentdatabase twice
  you can remove the second, db doesn't change in between
- you left doc.CopyAllItems(mDoc)
  isn't that just what you wanted to avoid? I suggest to leave that statement out
- there are more references to mdoc, e.g. mdoc.GetFirstItem("DocReaders")
  if there's no CopyAllItems (as I suggested), there won't be an item DocReaders
- you got the errormessage because you didn't save rDoc
  so add a statement
    Call rdoc.Save(True,False)
- you will have to set SendTo explicitly in mDoc
  so add a line with
    mDoc.SendTo= rDoc.SendTo

I'd move the line with Set mdoc= New NotesDocument to just before you start using mdoc. Make the Sub a consistent story:
1) create an rDoc
2) fill the rDoc
3) save the rDoc
4) then create the mDoc
5) fill mDoc to be a mail document
6) send mDoc as mail
0
 
JaziarAuthor Commented:
1.  set doc.CreateFlag= No
     There is a field CreateFlag = "yes" - so the action Send Email is Hidden if the field changes to No.  This is used to   hide the Send Email button.

2. there are more references to mdoc, e.g. mdoc.GetFirstItem("DocReaders")
  if there's no CopyAllItems (as I suggested), there won't be an item DocRead
   
There is a readers field "DocReaders" being populated - so I do need that.  There is a question on the form is this document view restricted - if yes then only the people in the sendto ever sees this document, if no everyone sees it. I think I need the copyallitems as well.

The script worked prefectly before, the only problem was the size of the emails it sent out.  I need for the script to peform the exact same actions but only send out a dummy email with a link to the Outgoing Request Form instead of sending the form in the email itself.  I will try to make your suggestions.
0
 
JaziarAuthor Commented:
Thanks for staying with me on this one - This is a show stopper and need to have it working as soon as possible.  I will increase the points for your time.  Also if you could clean up my script I would be grateful.

Thanks
0
 
qwaleteeCommented:
The old "large content" -- it was being copied from the data in the Outgoing Request Form?  And teh Outgoing Request form is one document with teh same large amount of data in it?  And this Outgoing Request Form is normally saved?  Because that's what Sjef was assuming with his first comment, and if that's taking you to the wrong document, then it means that nowhere in your code do you reference the correct form, so he and I have no way of knowing how to find the Outgoing Request Form.

Put it another way:  All we know is that you previously copied information from the document that is open on screen at the time this button is pressed.  If that is the correct document the mail should link to, well and good.  Otherwise, we don't have the information on what it shoud link to.  You may as well say, it shoudl link to the fourth document in the eleventh database on my backup dvelopment server.  OK?

     doc.CreateFlag = No    
Sjef was correct, this is bad code.  You probably need doc.createFlag = "No", not = No.


0
 
JaziarAuthor Commented:
You may as well say, it shoudl link to the fourth document in the eleventh database on my backup dvelopment server.  OK?  

Don't forget the moon has to be in the shadow of the 11th sun.  :)

Let me try to exaplain this better - sorry for the lack of details (not sure I fully understand them myself)


Form 1 = "Request"
Form 2 = "Outgoing Request Form"
Form 3 = "Response"  - Dont think this is one needed here
Form 4 = "Reply" - Dont think this is one needed here

In the database when Create Action is clicked it perform the following action.
@Command([Compose];"Request")

The Request form opens.

The purpose of this form is to start a threaded discussion (so to speak).  This document serves as a master and when people reply to it their responses are store in the document with links to thier response documents.  So some values from the the Response Form has to pass to all 4 forms.

The first field you fill out is RestrictedView.  If only certain is allowed to view the document you select yes - populates the readers fields.  
There is a dueDate field with a yes/no field to flag a reminder agent (work in progress).

So the information is enter (attachments may also be entered).

The send mail action(LotusScript) is clicked (see First Post Above).  The script checks for Restricted View, sets the flag for the reminder agent.  Populates the email to be sent to the people in the SendTo Field.

I think the agent is mailing Form 2 = "Outgoing Request Form" to the inbox of the SendTo Field.  They then click on the mail and they are in the database with the Outgoing Request Form open.  They enter some information and hit reply.

I need to get to the Outgoing Request Form by using a link instead of sending the form to the inbox.  The Outgoing Request Form is min. 80k.  I was wanting to be able to have the script do the same actions with the checks and setting fields, but only send a gerneric email with a doclink to Outgoing Request Form.  Then from there they should be able to complete the actions needed.

I hope this is more clear.  It is hard to explain.  Sorry about all the confussion
0
 
JaziarAuthor Commented:
Guys I am sorry if this question is not clearly stated.  I am doing my best to try and explain what I need to happen in the script.  If there are major gaps in my explaination, please let me know.  It is very important to me to get this working as soon as possible.  The simple explaination of it goes like this - Instead of the script sending the Outgoing Request Form in the email to the inbox, I need it to send a doc link in the email to the Outgoing Request Form.  That keeps the inbox size down.  Once again Sorry for any confussion.
0
 
qwaleteeCommented:
My poor small mind can't track this anymore, sorry.  Could probably be solved in 5 minutes, but only by actually seeing it.
0
 
JaziarAuthor Commented:
Quick Story

I can start a new question qwaletee - I need this to be solved as soon as possible - worth as many points as it take to solve - very important to me.  I have 2 showstoppers - this one and the one about the forward action not working.

as stated I can start a new thread if it helps!
0

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

  • 8
  • 3
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now