@Command([FileSave]); not saving

I have an action button on a form that is only visible in edit mode. The button is labeled “Save & Close”. The code under the button is:

@If(@Command([FileSave]); @Command([FileCloseWindow]); “”);

I have used this code many, many times before, and have never had a problem with it. If the document successfully saves, then the form closes. If the save is unsuccessful, the window doesn’t close. Simple right?

What is currently happening is that the window is simply closing. The edits are not saved. The users of the application have Author access to the database, and have a role assigned to them. This role (“[CourseEditors]”) is explicitly listed in an Authors field on the form. If the user makes an edit and clicks smarticon save button, or manually selects “File|Save”, then the changes are saved. If the user makes an edit and then hits the escape key or the “x” on the window tab, the document simply closes without a “Do you want to save your edits” message.

I have run Fixup and Compact on the database, with no luck. I have made a new copy of the datbase, with no luck. I have changed the code under the Save & Close action button from the formula to the following script (also with no luck):

Sub Click(Source As Button)

Dim nuiwsp As New NotesUIWorkspace

Dim nuidoc As NotesUIDocument



On Error Goto ErrorTrap

Set nuidoc = nuiwsp.CurrentDocument



Call nuidoc.Refresh()

Call nuidoc.Save()

Call nuidoc.Close()	

ExitPoint:

Exit Sub

ErrorTrap:

Resume Exitpoint

End Sub

When I turned the debugger on and stepped through the code, no error occurred. The “Call nuidoc.Save()” line appeared to have processed, but the changes were not saved.

When I test this using MY id, it works as expected. I have Manager access to the database, and have the same roles as the normal users.

Any ideas? I’ve been working on this for close to 30 hours and my brain is getting fried.

-Devin.

Subject: @Command([FileSave]); not saving

I feel your pain Devin,

Nothing worse than something that has worked for years and suddenly presents a mystery.

In all likelihood, you either are working locally and don’t have Enforce a consistent ACL across replicas enabled (so any roles you use in Author fields aren’t working)

OR

You have a SaveOptions field that is getting in the way.

Good Luck!

Subject: SOLVED: @Command([FileSave]) not saving

GARRG!You hit it spot on Mark. Sometimes the most obvious and simple things can be overlooked. There WAS a SaveOptions field on the form (I don’t know how it got there, there really isn’t any need for it.) Anyway, the SaveOptions field had the following code:

@If ( @IsMember ( “[EditAll]”; @UserRoles); @Return(“1”); “”);

vName := @UserName;

@If ( @IsMember ( vName; DACL_Authors ); “1”; “0”)

DACL_Authors is a MV Authors field, but only contains ROLES (not names). As I said before, the users have a role (which is listed in the DACL_Authors field), so they can edit the document. They do NOT have the “[EditAll]” role, but I do have it. So, if you look at the above formula, the SaveOptions field gets set to “1” for me, and to “0” for everybody else.

I have removed the field, and the application is now working correctly.

Thanks,

-Devin.