Press Ctrl / CMD + C to copy this to your clipboard.
This post will be reported to the moderators as potential spam to be looked at
I've developed a custom workflow to submit form data to a third party system. This submission can either succeed or fail and in the event of a failure it is important to let the user know it has not succeeded. I notice on the workflow's Execute method I can set WorkflowExecutionStatus.Failed in the event that the third party system does not accept the data but there doesn't seem to be any obvious way to handle this failure.
Ideally what I'd like is to either redirect the user back to the form and pop an error message, or even redirect them to a different page than the page specified in the "On Submit" dialog.
I might have an idea. I haven't tried it myself but it might work for you.
You could try to subscribe to the "WorkflowFailed"-event:
This would fire whenever a workflow has failed.
I don't know whether or not you have access to the same HttpContext as the posted form from that event.
I do know, however, that you do not have access to the record data from the event.
To subscribe to that event, I usually do it in the Global.asax file:
public class Global : UmbracoApplication
protected override void OnApplicationStarted(object sender, EventArgs e)
WorkflowService.WorkflowFailed += WorkflowService_WorkflowFailed;
private void WorkflowService_WorkflowFailed(object sender, Umbraco.Forms.Core.WorkflowEventArgs e)
// TODO: Handle error
Let me know if it works.
Thanks for the reply. I wasn't aware of the workflow failed event! I've already got a workaround in place whereby I add some info to the session cache (form id, record id) if it fails, using a special "WorkflowErrored" key and then I've used route hijacking on the success page to check for this value and handle appropriately.
I will check out the workflow failed event for next time though!
Good to hear you found a workaround.
Please let me know if you try the event and if it helped.
For reference to anyone on Forms 7.0, we are just overwriting the e.Form.GoToPageOnSubmit in our workflow to redirect to a 'failed' page (as we still capture the data on error and insert it into a different table).
One caveat is that we have our workflow last in the list and have the workflows running synchronously.
Any idea how to get e.Form.MessageOnSubmit work? I thought I had it working at one point, but I must be crazy because I can't seem to get any message I set on any workflow to override the message set on the default "Submit message / Go to page" workflow.
is working on a reply...
Write your reply to:
Image will be uploaded when post is submitted