Create a button on an email.Under the button write the following:
Sub Click(Source As Button)
Dim workspace As New NotesUIWorkspace
Dim uidoc As NotesUIDocument
Dim doc As NotesDocument
'Dim eval As Variant
Set uidoc = workspace.CurrentDocument
Set doc = uidoc.Document
'eval = Evaluate("@ProperCase(Subject)", doc)
Call doc.ReplaceItemValue("Subject", "eval")
'Call uidoc.Save
'Call uidoc.Refresh
Call doc.Save(True, False)
'Call uidoc.Save
'Call uidoc.Refresh
End Sub
Result: Nothing happends.
Expected Result: The Subject field is update with the word “Eval”.
A button with @SetField value is working fine.
Subject: What do you actually want
if you want the subject to have “eval” then your code should work
Subject: Yup
Thats what I was looking for.I can a (very very similar) code on a database document, and it does not have this problem (I can update other fields), whereas on an email, with a button, it doesn’t work.
As far as I remember it worked before (LN7)
Subject: remove the quotes
remove the quotes from around eval. the way your code is now you are telling it to put the word eval in the subject.
Subject: I know…
Hi Paul,Yes - I know.
I know what you mean.
I could try with the word subject if you like.
It seems you cannot access the memo, using a button on it, with LotusScript behind it.
For instance:
-
Create a new Memo on Lotus Notes Release 8.0.1 Revision 20080214.1630 (Release 8.0.1).
-
Create a hotspot button.
-
In the Hotspot button, add the following code, I removed the comments and used the word Subject for this example, instead of the word Eval:
Sub Click(Source As Button)
Dim workspace As New NotesUIWorkspace
Dim uidoc As NotesUIDocument
Dim doc As NotesDocument
Set uidoc = workspace.CurrentDocument
Set doc = uidoc.Document
Call doc.ReplaceItemValue("Subject", "Subject")
Call uidoc.Save
Call doc.Save(True, True)
End Sub
-
Expected Result. The word Subject is added to the Subject line in the currently open Email.
-
If you create a Hotspot button with the following it works fine:
@SetField(“Subject”;“Subject”)
-
My point is, that this sort of thing, worked fine in Lotus Notes 7, which meant that, one way of testing LotusScript code was create a button in an email and press it.
-
But now, you cannot do this.
-
I ran (almost exactly) the same code in an application database and it works fine, so something must be wierd about Notes 8 emails (for instance, maybe the security has been beefed up, and you can’t access them anymore 
Subject: reload uidoc
you need to reload the uidoc for the value you are setting in the backend doc to show
Sub Click(Source As Button)
Dim workspace As New NotesUIWorkspace
Dim uidoc As NotesUIDocument
Dim doc As NotesDocument
Set uidoc = workspace.CurrentDocument
Set doc = uidoc.Document
Call doc.ReplaceItemValue("Subject", "eval")
Call uidoc.Reload
End Sub
Subject: Thanks that works
OK thanks, that works.
It’s confusing - my original code works on a document in an application database.
Therefore I can only assume there is something special or different about a email document.