Solved

MailSend : InsertDocLink when document is being created

Posted on 2004-09-29
16
384 Views
Last Modified: 2013-12-18
Hi!

Here's the code, in the formula of an action bar Button:

@PostedCommand([FileSave]);
@MailSend("someone/something";"";"";"title";"";"see this document...";[PriorityNormal]:[IncludeDoclink]);
@If(@PostedCommand([FileSave]); @PostedCommand([FileCloseWindow]); "")

Code don't work if the the document is actually being created, and button is pressed.  (document saves, but MaiSend fails...)

Code works if I first save it with a regular Save button like:

@If(@PostedCommand([FileSave]); @PostedCommand([FileCloseWindow]); "")

...and then, re-open the saved document and press the previous button

????
0
Comment
Question by:barbotte
  • 4
  • 3
  • 3
  • +2
16 Comments
 
LVL 24

Expert Comment

by:HemanthaKumar
ID: 12183913
You cannot send unsaved document as mail doc link !!

First save the document and then use @mailsend

~Hemanth
0
 
LVL 9

Expert Comment

by:HappyFunBall
ID: 12184065
You might try this:

@If(@PostedCommand([FileSave]); @Do(@MailSend("someone/something";"";"";"title";"";"see this document...";[PriorityNormal]:[IncludeDoclink]); @PostedCommand([FileCloseWindow])); "")

that first @PostedCommand([FileSave]) is supposed to operate immediately in the formula, but if I remember correctly there's a bug that causes it not to work.  What else is new, right?

Another option would be to add the MailSend line as a formula in the PostSave event.
0
 
LVL 19

Expert Comment

by:RanjeetRain
ID: 12184086
Your question is your answer too. Food for thought:

What came first? Egg or the chicken?

Exactly! Exactly what Domino feels when you ask it to send a link to a document that doesn't physically exist yet. When you are editing a document, it is in the client's memory (webb browser or Notes client). It doesn't exist yet. Only when you call a save on it, it begins to exist (physically). Prior to it, it is just a unsaved working copy. And you cannot send a link to what doesn't exist yet!
0
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.

 
LVL 19

Expert Comment

by:RanjeetRain
ID: 12184114
It makes maximum sense to use a straight save such as @Command([FileSave]);

The document is being saved anyways, right?
0
 

Author Comment

by:barbotte
ID: 12413648
Increasing question points from 100 to 200...

Still do not work...  I tried different things:

@Command([FileSave]); just before the MailSend...

Putting the MailSend in the Postsave event...

I also tried to to another action button, completely independant, containing this formula:

FIELD SaveOptions :=  SaveOptions;
@SetField("SaveOptions"; "1");
@Command([FileSave]);
@PostedCommand([FileSave])

- - -

I've got a SaveOptions field in the form, of course...

So, even if I press this new button first, and after I press the "mailsend" button, the mail won't send WITH an IncludeDocLink...

Mail will always send if I don't not have an IncludeDocLink, but I must have one...
0
 
LVL 19

Expert Comment

by:madheeswar
ID: 12419774
tRY:
FIELD SaveOptions :=  SaveOptions;
@SetField("SaveOptions"; "1");
@Command([FileSave]);
@MailSend("someone/something";"";"";"title";"";"see this document...";[IncludeDoclink]);
@Command([FileCloseWindow])
0
 

Author Comment

by:barbotte
ID: 12524286
do not work!
0
 
LVL 19

Expert Comment

by:RanjeetRain
ID: 12526613
YOur best bet would be to use LS. You want code for that?
0
 

Author Comment

by:barbotte
ID: 12527320
What's LS anyway??
0
 
LVL 19

Expert Comment

by:madheeswar
ID: 12530535
LS stands for Lotus Script.


      Dim session As New notessession
      Dim db As notesdatabase
dim ws as new notesuiworkspace
dim uidoc as notesuidocument
            Dim doc As notesdocument
            Dim maildoc As notesdocument
      Dim Body As NotesRichTextItem
      
set uidoc=ws.currentdocument
set doc=uidoc.document
            Set db=session.currentdatabase
                  tmpname=doc.Fieldname(0)  'Fieldname is the field which holds person names.
            doc.Saveoptions="1"
                         

                  Set maildoc = New NotesDocument( db )
                  maildoc.Form = "Memo"
                  maildoc.Subject = _
                  "Please Review New Application"
                  Set Body=New NotesRichTextItem(maildoc,"Body")
                  message="Please Review the New Application"
                  Call Body.AppendText(message)
                  Call Body.AddNewLine(2)
                  message1="Please Click here to open the Link=========>>"
                  Call Body.AppendText(message1)
                  Call Body.AppendDocLink(doc,"Please Click this Link to open the Document")
                  Call maildoc.Send( True, tmpname )
call doc.save(true,true)
            call uidoc.close


Please the above code in an action button and use it.
0
 

Author Comment

by:barbotte
ID: 12534670
I tried to paste it on the action button, selecting "Lotus Script" and putting it in the default "Sub Click(Source As Button)"

Didn't work on Domino server...  Said it couldn't find the proper Database

???
0
 
LVL 24

Expert Comment

by:HemanthaKumar
ID: 12534726
Are you saving the doc before mailsend function ?
0
 
LVL 19

Accepted Solution

by:
madheeswar earned 200 total points
ID: 12541024
Sub Click(Source As Button)
Dim session As New notessession
     Dim db As notesdatabase
dim ws as new notesuiworkspace
dim uidoc as notesuidocument
          Dim doc As notesdocument
          Dim maildoc As notesdocument
     Dim Body As NotesRichTextItem
     
set uidoc=ws.currentdocument
set doc=uidoc.document
call doc.save(true,true)
          Set db=session.currentdatabase
               tmpname=doc.Fieldname(0)  'Fieldname is the field which holds person names.
          doc.Saveoptions="1"
                     

               Set maildoc = New NotesDocument( db )
               maildoc.Form = "Memo"
               maildoc.Subject = _
               "Please Review New Application"
               Set Body=New NotesRichTextItem(maildoc,"Body")
               message="Please Review the New Application"
               Call Body.AppendText(message)
               Call Body.AddNewLine(2)
               message1="Please Click here to open the Link=========>>"
               Call Body.AppendText(message1)
               Call Body.AppendDocLink(doc,"Please Click this Link to open the Document")
               Call maildoc.Send( True, tmpname )
call doc.save(true,true)
          call uidoc.close

End Sub


Place the above code in an action button.
0

Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I thought it will be a good idea to make a post as it will help in case someone else faces these issues. I trust this gives an idea how each entry in Notes.ini can mean a lot for the Domino Server to be functioning properly. This article discusses t…
IBM Notes offer Encryption feature using which the user can secure its NSF emails or entire database easily. In this section we will discuss about the process to Encrypt Incoming and Outgoing Mails in depth.
Established in 1997, Technology Architects has become one of the most reputable technology solutions companies in the country. TA have been providing businesses with cost effective state-of-the-art solutions and unparalleled service that is designed…
Finds all prime numbers in a range requested and places them in a public primes() array. I've demostrated a template size of 30 (2 * 3 * 5) but larger templates can be built such 210  (2 * 3 * 5 * 7) or 2310  (2 * 3 * 5 * 7 * 11). The larger templa…

856 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