shuboarder
asked on
Help with doc.sendto lotus script
I am trying to call the following from a button that is sent in an email.
Sub Sender
Dim s As New NotesSession
Dim db As NotesDatabase
Dim doc As NotesDocument
Set db = s.CurrentDatabase
Set doc = New NotesDocument(db)
doc.SendTo = doc.ReturnReceipt
doc.Subject = "Locations Processed"
doc.Body = "I have processed the button you sent"
doc.Send False
End Sub
Once the button is pressed I want an email to be sent to the names in the ReturnReceipt field
If the field is null I want it to not error out.
At the moment all I get is the following error:
Notes Error: No names found to send mail to
The ReturnReceipt field is a computed names field on a form with the following formula:
@If(
confirm = "Yes"; (@UserName);
confirm = "No"; "";
"")
The confirm field is a radio button with the options of Yes or No
Notes client 6.5
Any help much appreciated!
Sub Sender
Dim s As New NotesSession
Dim db As NotesDatabase
Dim doc As NotesDocument
Set db = s.CurrentDatabase
Set doc = New NotesDocument(db)
doc.SendTo = doc.ReturnReceipt
doc.Subject = "Locations Processed"
doc.Body = "I have processed the button you sent"
doc.Send False
End Sub
Once the button is pressed I want an email to be sent to the names in the ReturnReceipt field
If the field is null I want it to not error out.
At the moment all I get is the following error:
Notes Error: No names found to send mail to
The ReturnReceipt field is a computed names field on a form with the following formula:
@If(
confirm = "Yes"; (@UserName);
confirm = "No"; "";
"")
The confirm field is a radio button with the options of Yes or No
Notes client 6.5
Any help much appreciated!
ASKER
Thanks Sjef.... trust that to happen!
Still getting the same message however...
Sub Sender
Dim s As New NotesSession
Dim db As NotesDatabase
Dim doc As NotesDocument
Set db = s.CurrentDatabase
Set doc = New NotesDocument(db)
doc.SendTo = doc.ReturnReceiptTo
doc.Subject = "Locations Processed"
doc.Body = "I have processed the button you sent"
doc.Send False
End Sub
Still getting the same message however...
Sub Sender
Dim s As New NotesSession
Dim db As NotesDatabase
Dim doc As NotesDocument
Set db = s.CurrentDatabase
Set doc = New NotesDocument(db)
doc.SendTo = doc.ReturnReceiptTo
doc.Subject = "Locations Processed"
doc.Body = "I have processed the button you sent"
doc.Send False
End Sub
> doc.SendTo = doc.ReturnReceiptTo
Where do you think doc.ReturnReceiptTo should come from?? The object doc is a newly created document...
Where do you think doc.ReturnReceiptTo should come from?? The object doc is a newly created document...
ASKER
From the current document (received email) into a new document (new email)?
Something like ALAKAZOOM and there's the current document?? It don't go that way. You have to use the NotesUIWorkspace to get to the current document, like this
Dim ws As New NotesUIWorkspace
Dim curdoc As NotesDocument
Set curdoc= ws.CurrentDocument.Documen t
...etc
Dim ws As New NotesUIWorkspace
Dim curdoc As NotesDocument
Set curdoc= ws.CurrentDocument.Documen
...etc
ASKER
I realised that the coding was probably pretty poor... Besides ALAKAZOOM is more of a Microsoft command ;)
any particular order to declare things or does it not matter as long as it is declared before setting?
Still struggling....
Sub Sender
Dim s As New NotesSession
Dim db As NotesDatabase
Dim doc As NotesDocument
Dim ws As New NotesUIWorkspace
Dim curdoc As NotesDocument
Set db = s.CurrentDatabase
Set doc = New NotesDocument(db)
Set curdoc= ws.CurrentDocument.Documen t
doc.SendTo = doc.ReturnReceiptTo
doc.Subject = "Locations Processed"
doc.Body = "I have processed the button you sent"
doc.Send False
End Sub
any particular order to declare things or does it not matter as long as it is declared before setting?
Still struggling....
Sub Sender
Dim s As New NotesSession
Dim db As NotesDatabase
Dim doc As NotesDocument
Dim ws As New NotesUIWorkspace
Dim curdoc As NotesDocument
Set db = s.CurrentDatabase
Set doc = New NotesDocument(db)
Set curdoc= ws.CurrentDocument.Documen
doc.SendTo = doc.ReturnReceiptTo
doc.Subject = "Locations Processed"
doc.Body = "I have processed the button you sent"
doc.Send False
End Sub
Yeah, that's the 99% I gave, now you need to find out the 1% that's left to do. I'll give you again 99% of this 1%, effectively going to 99.99% of the solution.
Key question: if you want to get a value from the current document, why do you use the new document??
Key question: if you want to get a value from the current document, why do you use the new document??
ASKER
Because I want it to be a new email?
ASKER
Ok.... still not got it.
am I any closer?
Sub Sender
Dim s As New NotesSession
Dim ws As New NotesUIWorkspace
Dim db As NotesDatabase
Dim doc As NotesDocument
Dim uidoc As NotesUIDocument
Set db = s.CurrentDatabase
Set uidoc = ws.CurrentDocument
doc.SendTo = doc.ReturnReceiptTo
doc.Subject = "Locations Processed"
doc.Body = "I have processed the button you sent"
doc.Send False
End Sub
am I any closer?
Sub Sender
Dim s As New NotesSession
Dim ws As New NotesUIWorkspace
Dim db As NotesDatabase
Dim doc As NotesDocument
Dim uidoc As NotesUIDocument
Set db = s.CurrentDatabase
Set uidoc = ws.CurrentDocument
doc.SendTo = doc.ReturnReceiptTo
doc.Subject = "Locations Processed"
doc.Body = "I have processed the button you sent"
doc.Send False
End Sub
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
1) That's the 0.01% :(
2) To Marilyn: who says there's only one address in ReturnReceiptTo ??
2) To Marilyn: who says there's only one address in ReturnReceiptTo ??
Of course there can be more than one ReturnReceiptTo, so just take the (0) off the end. You advised right, but shuboarder forgot to change the doc ReturnReceiptTo to something that contained something.
oh, darn, did I stomp on your attempt to get shuboarder to figure it out? So, sorry, I just now read the top of your comments.
oh, darn, did I stomp on your attempt to get shuboarder to figure it out? So, sorry, I just now read the top of your comments.
LOL
Shuboarder, if you want us to explain, please say so...
Shuboarder, if you want us to explain, please say so...
ASKER
Yes please!
I do need to learn all this stuff.
I do need to learn all this stuff.
ASKER
BTW I still can't get this to work!
I'm getting an object variable not set.
I'm getting an object variable not set.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Thanks Sjef,
I'd say thanks for trying to help me get it on my own as well except for the fact I spent way too long on it yesterday and got nowhere. Without a full understanding of Lotus Script it is still very much a case of trial and error for me.
I'd say thanks for trying to help me get it on my own as well except for the fact I spent way too long on it yesterday and got nowhere. Without a full understanding of Lotus Script it is still very much a case of trial and error for me.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Hi Sjef,
thanks for the explanation. I already have a book called Lotus Notes and Domino 6 Programming by Benz Oliver.
It's useful to an extent as is your explanation in that I understand fully what you are saying.
However, the actual practicality of it is much more difficult for me.
I suppose a lot of it is just down to experience and repetition. :)
thanks for the explanation. I already have a book called Lotus Notes and Domino 6 Programming by Benz Oliver.
It's useful to an extent as is your explanation in that I understand fully what you are saying.
However, the actual practicality of it is much more difficult for me.
I suppose a lot of it is just down to experience and repetition. :)
There was this painter on television. Every now and then, he took all the paintings from the last few months, looked at them very carefully with his expert eyes, and then he happily put 70% of his paintings into a fire. When asked why he did so, he answered that these paintings weren't good enough to be sold. But they needed to be painted anyway, because he couldn't paint only good paintings.
May I suggest you go on painting, and painting, and painting...?
May I suggest you go on painting, and painting, and painting...?
ASKER
Thanks Sjef, I will!
Suggested name:
ReturnReceiptTo
with formula
@If(confirm = "Yes"; @UserName; "")