0

I'm working on a project that involves workplace incident reporting and management, and one key requirement is that whenever someone starts to report an incident, whether they finish it or not, an email must be sent to hr outlining the incident as per company policy.

Each incident is submitted through a standard newform.aspx, which is reached through a button on the homepage.

I'm having difficulty getting that information when the user does not submit it though, as I haven't found a way to trigger an email when the page is either closed or they move to a different page.

The only partial solution I was able to come up with is to get the user's information when they click the button for newform.aspx and send that off to HR for them to manually follow it up, but that seems like a poor way to do it.

Please let me know if there is a better solution.

Jesse Bell
  • 23
  • 3

1 Answers1

1

If you are using SharePoint 2013 or later... in a nutshell:

  1. Add JavaScript to the New form that on detects a move from the page. (for example: Event when window.location.href changes) and writes an entry to another SharePoint list using the SharePoint REST API call with any needed data.
  2. The second list has a SharePoint workflow that sends the email.

It's never that simple though. You have to intercept the Save buttons on the form to that you will know if the page exit was from a Save or other exit.

Mike Smith - MCT
  • 1,166
  • 1
  • 9
  • 15