[Webinar] Streamline your web hosting managementRegister Today

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 162
  • Last Modified:

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.
0
Z_Beeblebrox
Asked:
Z_Beeblebrox
1 Solution
 
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

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now