Lotuscript and QueryClose and QuerySave

Hi ,The following code creates a response document. This code works fine when I run it using a agent in queryclose event.

But it does not run when when it is field with the help of agent is query save .

If corepresentflag= “No” Then

					Set facdocParent= db.getdocumentbyUNID(ParentDocID )

		Coredoc.FacilityName =facdocParent.FacilityName

		Coredoc.FacilityID =facdocParent.UniversalID

		Call  Coredoc.MakeResponse( facdocParent)

		Call Coredoc.Save(True, False)

		

	End If.

While testng ( for Query Save) .I found that the documents are set ( using debugger) but no response is create .

Any help is greatly appreciatiated.

Thanks

Sushant

Subject: Lotuscript and QueryClose and QuerySave

My guess is you’re trying to make the UI Document (current) a response document, yet it hasn’t been saved yet.

You want to move your code to the PostSave or QueryClose. (Not sure why you want it in the QuerySave).

Subject: RE: Lotuscript and QueryClose and QuerySave

Hi Stephen,Thanks a lot for your reply. you are right i want to make UI document as response . I was thinking the back document corresponding to UI document can be saved in Querysave event.

I just refered to help and it says in event sequencing that Query save is triggered when before document is save .

That means for my case i cannot make a response in Query Save at all . I tried to the same code in post save . I find that response is create.

can you tell me why can’t be a document be saved in query save( i know that in web query save document get’s automatically saved. ) why there is a difference in webquerysave and query save…??

also there is no post save in web

Thanks

Sushant

Subject: RE: Lotuscript and QueryClose and QuerySave

In the form properties for your response document is it set up to be of type response? If not then it reverts to being a main document the next time it is saved which would explain why it works in the PostSave event but not the QuerySave.

After your code in the QuerySave event then the front end document is saved whilst in the PostSave event the front end document has already been saved.

Subject: RE: Lotuscript and QueryClose and QuerySave

Hi Matt ,I this the Form properties → Info → type is set to Document.

and response document is not getting created in query save event.

Thanks

Sushant

Subject: RE: Lotuscript and QueryClose and QuerySave

Then that is the reason why it is not working. Your QuerySave code initially saves it as a response document but at the end of the QuerySave it automatically saves the front end document and it reverts to being a main document.

Set the type to response and it will work.

Subject: RE: Lotuscript and QueryClose and QuerySave

Thanks a lot Matt . It is working now .

Subject: Lotuscript and QueryClose and QuerySave

“But it does not run when when it is fired agent in query save” instead of "But it does not run when when it is field with the help of agent is query save "