Saving new version - in PostSave Event

Hi, My requirement is below:

I have a buton called “archive new”.

I open document, change any field which is already entered and click ‘save and close’ button

So when I do this certain fields will be compared with old ones

and if any change then pop up a msgbox if user wants to archive or not.

If yes then old one will be archived and new one will have diff field value which I have entered.

I have written the code in PostSave event. and getting the work done. But i am receiving the following error ‘Attempt to execute nested form events’

sample code is pasted below.

Dim uidoc As NotesUIDocument

Dim dateTime As New NotesDateTime( “Today” )

Dim workspace As New NotesUIWorkspace

Dim GrantorType As String

Dim Grantor_1Type As String

GrantorType = Source.FieldGetText(“Grantor”)

Grantor_1Type = Source.FieldGetText(“Grantor_1”)

Set uidoc = workspace.CurrentDocument

If source.IsNewDoc = True Then

Call uidoc.FieldSetText( “Grantor_1”, GrantorType )

Call uidoc.save

Else

Call uidoc.FieldSetText(“Modifications”,“”)

Call dateTime.AdjustYear(-1)

Call uidoc.FieldSetText(“FirstName”, “”)

Call uidoc.FieldSetText(“LastName”, “”)

Call uidoc.SaveNewVersion

Call uidoc.FieldSetText(“Form”, “New Info”)

Call uidoc.Refresh

answer% = Messagebox(“Your new form created.”,0 ,“Process Complete”)

End If

Pls help me to solve this issue.

Subject: saving new version - in PostSave Event

The error ‘Attempt to execute nested form events’ usually occurs when you try to run a code from an event that is caused from the code itself.Explanation:

Here your code runs from the postsave event, but it contains

Call uidoc.save.

So your code should run again since the event postsave will run it and so on.

Try to find another place to put your code in.

Fadi Kiwan