Problem with LS in views!

Hope anyone is better than me at LS. I use this in a form (Button).When a press the button a call correspondencemail(ScriptLibraries) and it’s work fine.

Now a will move this function to a button in a view, how will achange the LS. I tried some things but it’s not work.

I now that i could not use workspace.CurrentDocument and so but i don’t get it to work.

Anyone who could help me to the right track.

Dim session As New notessession

Dim workspace As New NotesUIWorkspace

Dim uidoc As NotesUIDocument

Dim doc As NotesDocument



Set uidoc = workspace.CurrentDocument

Set doc = uiDoc.Document





whenNow$ = Today()	

Call uidoc.FieldSetText("AvslDat",whenNow$)

Call uidoc.FieldSetText("AvslTime",Time$())

Call uidoc.FieldSetText("AvslAv",Cstr(session.CommonUserName))

Call uidoc.FieldSetText("Status", "Closed")



Call uidoc.Save

Call uidoc.Close	



If uiDoc.FieldGetText("notifyUser") <> "" Then

	Call correspondencemail ("Close")

End If

Kind regards

David

Subject: Problem with LS in views!

U can’t refer uidoc in view action. U have one more notes class that is Notesuiview. Using this u can get the handle to the document as follows.

Dim session As New notessession

Dim workspace As New NotesUIWorkspace

Dim uiview As NotesUIview

Dim doc As NotesDocument

Set uiview = workspace.Currentview

Set doc = uiDoc.getfirstdocument

whenNow$ = Today()

doc.AvslDat(0) = whenNow$

doc.AvslTime(0)=Time$()

doc.AvslAv(0)= Cstr(session.CommonUserName))

doc.Status(0)=“Closed”

Call doc.Save(true,true)