Link to home
Start Free TrialLog in
Avatar of Z_Beeblebrox
Z_Beeblebrox

asked on

Button that changes a field then saves and exits

I have a button which is supposed to set the contents of a few fields, then save and exit the document. For some reason, even if my button does a FileSave, I still get prompted to save the document when the FileCloseWindow is called.
Avatar of shabala
shabala

Try a scipt like this:

Sub Click(Source As Button)
     Dim session As New NotesSession
     Dim db As NotesDatabase
     Dim docA As NotesDocument
     Dim u As notesuidocument
     Dim w As New notesuiworkspace
     Dim item As NotesItem
         
     Set u=w.currentdocument
     Set docA=u.document
     Set db = session.CurrentDatabase
     Set item=docA.ReplaceItemValue("FieldName","itemvalue")
     Set item=docA.ReplaceItemValue("FieldName","itemvalue")
     Set item = docA.GetFirstItem("FieldName","itemvalue")
     Call docA.Save( True, True )
     
     Call u.Close
End Sub
Avatar of Z_Beeblebrox

ASKER

A couple of problems with this. First, the line:
Set item = docA.GetFirstItem("FieldName","itemvalue")
brings up a script error. I don't even know what this line is supposed to be doing so I don't know how to fix it. If I comment out that line, I still get the prompt to save the document.

Also, using script for this button is problematic, since my button has to change the field contents based on who the current user is and it has to send an e-mail. This is very easy to do using @functions, and I have already done so. I am not sure how to do this using script. Therefore I would prefer if I could stick with @functions and actions.

Thanks,

Zaphod.
ASKER CERTIFIED SOLUTION
Avatar of srandrews
srandrews

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial