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.
LVL 7
Z_BeeblebroxAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

shabalaCommented:
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
0
Z_BeeblebroxAuthor Commented:
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.
0
srandrewsCommented:
Try using:
@PostedCommand([filesave]);
@PostedCommand([filecloseWindow]);
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Lotus IBM

From novice to tech pro — start learning today.