Delete document via web through LS agent

Hi , when saving document I check if save conflict occured , I tried to delete the document using lotus script agent called in webquerysave event

LS code :

Sub Initialize

Dim s As New NotesSession

Dim doc As notesdocument



unid$ = source.document.UniversalID

Set doc = s.currentdatabase.GetDocumentByUNID( unid$ )



ret=doc.save(True, False)

If ret=True Then

	If doc.HasItem("$Conflict") Then

            Call doc.Remove( True )   

	End If 	

End If

End Sub

unfortunalty the document not deleted , I am using the right statment for deletion ??

thanks and regards

Subject: Delete document via web through LS agent

Dear Hajar,

Why u r using this statement :

source.document.UniversalID

source is for notes only not for web , So better u change with notesdocument class.

then write back

Rishi

Subject: RE: Delete document via web through LS agent

Hi Rishi ,

Since I am new in LS I use the source , how can I use the notesdocument class , another quetion , in the agent proparties in basic tab :

in runtime section :

I used action menue selection

for Target I used none …

Is it right ?

Thanks and regard

Subject: 100% right u r , for web u can use only this combination

Subject: RE: 100% right u r , for web u can use only this combination

thanks alot …but how about my question how can I use the notesdocument class to define the current document .

I couldn’t find something in the help related to classes

thanks again

any

Subject: Delete document via web through LS agent

Hi,

To get the current document from the web use the webquerysave event on the form to call an agent that performs that what you want.

In the agent use notesDocument = notesSession.DocumentContext to get a handle to the document.

Subject: RE: Delete document via web through LS agent

Note that LotusScript is only available in webQuery agents, in web applications.

Domino server will process the Forms and render it as HTML to the frontend browsers… in this case, you cannot directly call NotesUI classes.

That’s why we need to use NotesSession.DocumentContext in webQuerySave agent to get a handle of current document.

Subject: RE: Delete document via web through LS agent

Hi to all ,

I used the following script in webquerysave , to delete the document when saveconfilct occured , can any body help why the following not working :

Sub Initialize

Dim session As New NotesSession

Dim doc As NotesDocument

Set doc = session.DocumentContext

ret=doc.save(True, False)

If ret=True Then

If doc.HasItem(“$Conflict”) Then

Call doc.Remove( True )

End If

End If

End Sub

Note : server rel 5

   client rel 6 

thanks and regards