Skip to content

Settings with default values not posted to server when submitting custom workflow, unless altered #1421

@eqtr-ab

Description

@eqtr-ab

Which Umbraco Forms version are you using? (Please write the exact version, example: 13.4.0)

15.1.2

Which Umbraco version are you using? (Please write the exact version, example: 13.5.2)

15.4.2

Issue summary

When a setting within a custom workflow has a default value defined in app settings, that value is not posted to the server when first adding the workflow to a form. The setting is only posted when the value in the field is changed.

Specifics

No response

Steps to reproduce

I have implemented a custom workflow in Umbraco Forms for the purposes of CRM integration. The workflow defines a settings field, which I validate in ValidateSettings as follows:

[Setting("Event Type", Description = "Sets the event type when communicating with Bloomreach")]
public string EventType { get; set; } = "";

...

public override List<Exception> ValidateSettings()
{
    var exceptions = new List<Exception>();
    
    if (string.IsNullOrWhiteSpace(EventType))
    {
        exceptions.Add(new Exception("Event Type is required"));
    }

    return exceptions;
}

I also have a default value added to this field via the following app setting, with B0771D85... being the custom workflow's GUID:

"Forms": {
  "FormDesign": {
    "SettingsCustomization": {
      "WorkflowTypes": {
        "B0771D85-6A42-4D2F-B96C-E77DB43C820F": {
          "EventType": {
            "DefaultValue": "web_enquiry"
          }
        }
      }
    }
  }
}

When submitting the form to add the workflow without changing the default value, the frontend is not passing settings data, leading to the validation failing. The request data instead looks like this:

{"name":"Bloomreach","settings":{}}

Which results in this 400 response:

{"type":"Error","title":"Settings validation failed.","status":400,"detail":"Event Type is required"}

However if I change the value in the EventType field and try again, the "settings" field is populated correctly:

{"name":"Bloomreach","settings":{"EventType":"web_enquiry."}}

Expected result / actual result

Expected result: Settings with default values are included in the workflow create request

Actual result: Settings with default values are missing from the workflow create request, leading to validation errors


This item has been added to our backlog AB#56513

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions