I have a SP 2010 site workflow with an InfoPath initialization form. After the user fills in the data in the init form he submits the form and the workflow starts with the WorkflowActivated event.

If WorkflowActivated throws an exception, how do I notify the user of the error? The form is closed and worked well but everything failed after control reached the Workflow.

Is there a way to somehow notify the user that the workflow failed to start?

1 Answer 1


Why not use the SPUtility.SendEmail() method in your catch block?

  // Do stuff
catch (Exception ex)
  // Handle error

  string strUserEmailAddress = "Set the email address here";
  string strSubject = "Workflow Failed to Start";
  string strHTMLBody = "<body><div>Format some message here</div></body>";

  using (SPSite site = new SPSite("siteurl"))
    using (SPWeb web = site.RootWeb)
      SPUtility.SendEmail(web, true, false, 
                          strUserEmailAddress, strSubject, strHTMLBody);


  • Unfortunately that won't work. The application already sends mails, the user can go to multiple pages and see if all was OK (workflow creates visible items in the site) etc. But user won't do that. He enters the data, then it's "fire and forget". I need an immediate feedback!
    – JohnDoDo
    Jul 20, 2012 at 7:12
  • The workflow code is running outside of the context of the browser, so how else would you inform the user? You could write some kind of custom ticker control and throw it in the master page and have it read data from a list. Then instead of email you could just write an item to the list. But that is way more complicated, and you have to set up filtering based on the user who is logged in. Sending an email to let them know they need to resubmit that form is the simplest and quickest way to ensure this information reaches your user. Jul 20, 2012 at 16:52

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.