barbotte
asked on
MailSend : InsertDocLink when document is being created
Hi!
Here's the code, in the formula of an action bar Button:
@PostedCommand([FileSave]) ;
@MailSend("someone/somethi ng";"";""; "title";"" ;"see this document...";[PriorityNorm al]:[Inclu deDoclink] );
@If(@PostedCommand([FileSa ve]); @PostedCommand([FileCloseW indow]); "")
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([FileSa ve]); @PostedCommand([FileCloseW indow]); "")
...and then, re-open the saved document and press the previous button
????
Here's the code, in the formula of an action bar Button:
@PostedCommand([FileSave])
@MailSend("someone/somethi
@If(@PostedCommand([FileSa
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([FileSa
...and then, re-open the saved document and press the previous button
????
You might try this:
@If(@PostedCommand([FileSa ve]); @Do(@MailSend("someone/som ething";"" ;"";"title ";"";"see this document...";[PriorityNorm al]:[Inclu deDoclink] ); @PostedCommand([FileCloseW indow])); "")
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.
@If(@PostedCommand([FileSa
that first @PostedCommand([FileSave])
Another option would be to add the MailSend line as a formula in the PostSave event.
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!
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!
It makes maximum sense to use a straight save such as @Command([FileSave]);
The document is being saved anyways, right?
The document is being saved anyways, right?
ASKER
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...
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...
tRY:
FIELD SaveOptions := SaveOptions;
@SetField("SaveOptions"; "1");
@Command([FileSave]);
@MailSend("someone/somethi ng";"";""; "title";"" ;"see this document...";[IncludeDocli nk]);
@Command([FileCloseWindow] )
FIELD SaveOptions := SaveOptions;
@SetField("SaveOptions"; "1");
@Command([FileSave]);
@MailSend("someone/somethi
@Command([FileCloseWindow]
ASKER
do not work!
YOur best bet would be to use LS. You want code for that?
ASKER
What's LS anyway??
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,"Pl ease 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.
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,
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,"Pl
Call maildoc.Send( True, tmpname )
call doc.save(true,true)
call uidoc.close
Please the above code in an action button and use it.
ASKER
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
???
Didn't work on Domino server... Said it couldn't find the proper Database
???
Are you saving the doc before mailsend function ?
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
First save the document and then use @mailsend
~Hemanth