I have some custom code in the Queryclose event of the default Appointment form in the Notes mail template. This code copies the appointment doc into a new database if certain fields meet certain conditions.
The problem I have is that being on the Queryclose event, this code will run even if a user decides not to save a new appointment doc and chooses not to save any changes. This causes a draft appointment to be created in the mail database and the copy to database.
Is there a way using LS in the queryclose event that I can check if the user has cancelled the document and does not wish to save it?
Subject: How to know if “Cancel Save” has been selected in Queryclose?
I guess you could set a global variable in PostSave and check for that value in QueryClose to see if the save happened. But wouldn’t it be easier to just move your QueryClose code to PostSave?
Subject: RE: How to know if “Cancel Save” has been selected in Queryclose?
I need to call a “source.save” in the script for Queryclose event so that the document is saved back to the database before it can be copied - AFAIK you cant do a “source.save” in the Postsave event?
I’ll look into setting a global variable in the post save event.
Subject: RE: How to know if “Cancel Save” has been selected in Queryclose?
It sounds like you might be trying to prevent the user from exiting w/o saving? If so, just use a SaveOptions field and skip all the LS.