Description
Which Umbraco Forms version are you using? (Please write the exact version, example: 13.4.0)
8, 10 & 13
Which Umbraco version are you using? (Please write the exact version, example: 13.5.2)
13.7.1
Issue summary
We have several custom Workflow integrations that map "custom" fields from an external api to umbraco fields. The code is pretty similar to the Umbraco.Forms.Integrations for Hubspot and Active Campaign Umbraco Forms integrations.
Whenever a workflow is created or a form is saved we want to verify that all mapped fields are actually (still) valid.
To validate the settings of our workflow we need access to the Form the workflow is attached to. When you save a workflow it calls WorkflowController/ValidateWorkflowSettings which in turn calls the ValidateSettings on the (custom) workflow.
However the Workflow is not passed any parameters and the Workflow.Form is pretty much always empty, which doesn't allow us to retrieve the actual form attached to the workflow so we don't know which form fields exist.
We are currently forced to intercept the save function of UmbracoForms.Editors.Form.EditController so that we can rewrite the ValidateWorkflowSettings call to a custom execute ValidateWorkflowSettings
endpoint. The only difference between this endpoint and the umbraco forms endpoint is that when umbraco copies the workflow:
Workflow workflow2 = new Workflow();
we modify it to include the Form that is passed in the ValidateWorkflowSettings viewmodel.
var workflow2 = new Workflow() { Form = workflowViewModel.Form };
this way we have access to the form its attached to.
It would be nice to have this happen by default, or even better, give direct access to the Form Fields in the Workflow itself. I know that when you create a new form and attach a workflow it won't have access the Form Fields as they aren't saved yet, or if you add new fields as the validate happens before saving. If the ValidateWorkflowSettings would be called with the new fields then that also allow us to handle those situations.
I noticed that none of the "official" Umbraco Forms Integrations never implement the validate workflow settings function either. They just return an empty list. I assume this is caused by the inability of accessing the Umbraco Form fields attached the workflow and not wanting to override the default umbraco backoffice functions.
Specifics
No response
Steps to reproduce
Create a new a custom WorkflowType and try to access Workflow.Form in the ValidateSettings() function
Expected result / actual result
Get direct access to the Umbraco Form Fields the workflow is attached to and/or get passed data the updated Form with its the new Form.AllFields we need to validate.