Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Aaron 22 posts 93 karma points
    Apr 03, 2018 @ 09:10
    Aaron
    0

    Stop subsequent workflow steps

    Hello

    I have a workflow step that posts back to an Umbraco api controller which does some validation.

    If the validation fails then any subsequent workflow steps should not occur.

    I'm only aware of the manual checkbox to disable workflow steps.

    There is also the custom workflow type which returns a WorkflowExecutionStatus enum, but that doesn't seem to affect subsequent execution of workflow steps.

    Can this be done programmatically?

  • Tito 292 posts 514 karma points
    May 13, 2020 @ 17:17
    Tito
    0

    Any updates on this? how did you got it?

  • James 15 posts 107 karma points
    Aug 03, 2021 @ 03:59
    James
    0

    Did you ever find a solution for this?

  • Tito 292 posts 514 karma points
    Aug 03, 2021 @ 09:07
    Tito
    0

    Yes, you can implement the FormValidate event:

    protected override void ApplicationStarted(UmbracoApplicationBase umbracoApplication, ApplicationContext applicationContext)
    {
       Umbraco.Forms.Web.Controllers.UmbracoFormsController.FormValidate += UmbracoFormsController_FormValidate;
    }
    void UmbracoFormsController_FormValidate(object sender, Umbraco.Forms.Mvc.FormValidationEventArgs e)
    {
      //Here you can validate the form in e.Form and fill the errors like this:
      sender.ModelState.AddModelError("name", "Name is required");
      //Where "name" is the alias of the field
      //If there are errors in the ModelState the form doesnt continue execution
    }
    
  • Damien Holley 146 posts 485 karma points
    1 week ago
    Damien Holley
    0

    Sorry Tito, is this implemented in your main Umbraco Application or elsewhere?

  • Tito 292 posts 514 karma points
    1 week ago
    Tito
    0

    Hi, you can implement it in any class that inherits ApplicationEventHandler

Please Sign in or register to post replies

Write your reply to:

Draft