Programatically cancel or save...
Posted: 08 Jun 2017
Hello again,
So may latest obstacle is that I would like when a user clicks cancel on a form for a function to run and complete before the form is actually cancelled. This is because on the form items are added to another list via related items control, however if they do this then cancel the items will remain on the list.
I am hoping to run some sort of 'clean up' function that would would remove any items added from the list, which is currently done via a REST query, although if you can think of a better way let me know.
The trouble is whether the form will cancel before the code has a chance to run. In theory the easiest way I thought would be to create my own button that runs the code then at the end of the function a command to cancel the form like the cancel button, however I am not sure if there is one? Otherwise would there be a way to check if the function has completed or wait for it to do so before the form is cancelled.
Any suggestions are welcome,
Thanks.
So may latest obstacle is that I would like when a user clicks cancel on a form for a function to run and complete before the form is actually cancelled. This is because on the form items are added to another list via related items control, however if they do this then cancel the items will remain on the list.
I am hoping to run some sort of 'clean up' function that would would remove any items added from the list, which is currently done via a REST query, although if you can think of a better way let me know.
The trouble is whether the form will cancel before the code has a chance to run. In theory the easiest way I thought would be to create my own button that runs the code then at the end of the function a command to cancel the form like the cancel button, however I am not sure if there is one? Otherwise would there be a way to check if the function has completed or wait for it to do so before the form is cancelled.
Any suggestions are welcome,
Thanks.