Programatically cancel or save...

Discussions about Forms Designer for SharePoint 2013 / 2016 and Office 365.
Locked
joss.wilde
Posts: 18
Joined: Wed May 17, 2017

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.

User avatar
Dmitry Kozlov
Site Admin
Posts: 1524
Joined: Thu Jun 07, 2012

08 Jun 2017

Hi,
In my opinion, the easiest way would be creating a workflow or a flow that is executed periodically or when a new item is added and removes all items without a parent and created say more than a hour ago.

joss.wilde
Posts: 18
Joined: Wed May 17, 2017

08 Jun 2017

Thanks again for the suggestion Dmitry, it may well be the best option I think, just need to look into workflows as I am still new to much of this. For the moment I just have performing a clean-up function when the form is loading, which isn't ideal since it would leave the items in the list until a new form is opened...perhaps a combination of both ideas...

Locked
  • Information
  • Who is online

    Users browsing this forum: No registered users and 3 guests