Querysave works but same code in button does not

I am at the end of creating a workflow app. However due to business rules I need to change a field update procedure and this for some reason the function won’t work.

form 1: formProject

form 2: formCompletion

Document Locking is on.

All Lotusscript

While in a formProject based document(read mode) I create a document via LS with formCompletion (not a response). In the querysave event of the formCompletion I call a function (tried sub too) that will update a computed field on the original formProject document with a text value of completed. it works when the function is called from the querysave event of the formCompletion. However the customer wants the field updated when a manual notification email is sent out which is already in a button. I move the Function call from the querysave event to the button. since I have locking turned on I am testing to make sure the original document is not locked and it’s not in edit mode before updating. Once the function call is moved into the button that also launches an email, the function no longer works. No error is tripped. I followed debug and the field just never get’s set. Yes I am saving it. This function works when called from a querysave event but not in a button. It does work if I manually close the original (formProject) document in the background and then switch back to the formCompletion document and hit the button to send the email calls the update function.

I did a search in this forum but couldn’t find anything close to what I describe. Anyone have any suggestions?

Subject: querysave works but same code in button does not

Just being pedantic here but, put a javascript button on the page that alerts/displays the formProject reference as it sits on the formCompletion doc. I had a similar problem recently, and it turned out that under certain conditions the reference field was not available on the second form.Also, put a computed text field on the form that goes off and pulls back a field value from the formProject form.

As i said, pedantic, but simple things tend to be the answer.

Subject: RE: querysave works but same code in button does not

Thank you for the response. I’m using a Notes client and for some reason Javascript doesn’t work well. I ended up changing the way I approach it in order to fix it. In my notification button I was also updating the editor field in all supporting documents to basically lock the documents from editing. What I did was add the status field to a subform so they all had a status field and just updated the field in the document collection I used to gather all supporting documents. Simple and it worked fine. I think I may have been bumping into the function at some point but debug never showed it since debug slows down to step by step execution.