I am trying to do something very simple. Or so I thought.
I am writing a personal agent that the user will trigger from the Action menu in a new open email that has not been saved or sent.
I have one big limitation. Since I am working in the standard mail template (5/6/6.5+) I am not allowed to modify the design of the db in anyway other than adding a personal agent.
Here is what I need to do:
1 Save the email that is in the UI
2 Get a handle on the email in the UI and write its UNID in the notes.ini
3 Close the email in the UI
4 Run an agent in another db that will do some processing on the email.
My issue is that no matter what I do I am prompted to save the email everytime the quesryclose event triggers.
Here is some code
Set ws = New NotesUIWorkspace
Set s = New NotesSession
Set mDB = s.currentDatabase
misDBPath = s.GetEnvironmentString(“misDB”)
Set misDB = New NotesDatabase(“”,misDBPath)
Set uiEmail = ws.CurrentDocument
Set tmpmailDoc = uiEmail.Document
Call tmpmailDoc.Save(False,False,True)
'Set env var here
tmpmailDoc.SaveOptions=“0”
Call uiEmail.Reload
Call uiEmail.Save
Call uiEmail.Close
'Run the agent
I also tried to do it in Formula
@PostedCommand([FileSave]);
@Environment(“MISuidocID”;@Text(@DocumentUniqueID));
FIELD SaveOptions:=SaveOptions;
@SetField(“SaveOptions”;“0”);
@PostedCommand([FileSave]);
@PostedCommand([FileCloseWindow]);
@PostedCommand([FileOpenDatabase];“”:“MIS\Mailer.ns5”);
@PostedCommand([ToolsRunMacro];“(agMailRunner)”);
@PostedCommand([FileCloseWindow])
I have tried several variations but I always get prompted for the save…
PS I know adding the saveoptions might be considered as “modifying” the mail template…
Any suggestions or ideas would be appreciated.
Karl