How can I create a template with custom workflows preconfigured?
I am building an integration of Umbraco Forms 6.0.2 into Umbraco 7.6.4 and would like to create a template that will come with some custom workflows that I've created preconfigured so that I can define a starting point for editors.
I've figured out how to add a template, but any workflows I add to the template json will not appear. Looking at the workflow IDs it seems they are associated with a particular form ID.
Has anyone managed to do this? I've found the documentation a little sparse in places
It looks like the Umbraco Forms API doesn't expose anything for me to tap into to configure this - if it does, I can't find the documentation.
I initially thought about creating a controller and deriving it from Umbraco.Forms.Web.Editors.FormController and creating my own implementation of GetScaffoldWithWorkflows(string template) and do some magic routing to get my action method invoked instead of the Umbraco Forms one. Not 100% on the best way of going this, some Googling led me to custom action filters, but I don't want to go down that route.
The other thought I had was modifying umbraco.forms.js to call out to my own endpoint that will generate a list of workflows to apply to $scope.form in the front-end, but I'm hesitant to do this as it will put the front-end into essentially an "unspported" state due to making customisations, which could have an impact on future updates to Umbraco Forms.
[PluginController("UmbracoForms")]
[UmbracoApplicationAuthorize("form")]
public class MyFormController : UmbracoAuthorizedJsonController
{
public FormDesign GetScaffoldWithWorkflows(string template)
{
var NewForm = new Umbraco.Forms.Web.Editors.FormController().GetScaffoldWithWorkflows(template);
NewForm.FormWorkflows.OnSubmit.Clear();
NewForm.FormWorkflows.OnSubmit.Add(...);
return NewForm;
}
}
In addition to this, I've updated line 3529 of umbraco.forms.js to call my controller instead of the Umbraco one, and it seems to work!
How can I create a template with custom workflows preconfigured?
I am building an integration of Umbraco Forms 6.0.2 into Umbraco 7.6.4 and would like to create a template that will come with some custom workflows that I've created preconfigured so that I can define a starting point for editors.
I've figured out how to add a template, but any workflows I add to the template json will not appear. Looking at the workflow IDs it seems they are associated with a particular form ID.
Has anyone managed to do this? I've found the documentation a little sparse in places
So a few thoughts on this:
It looks like the Umbraco Forms API doesn't expose anything for me to tap into to configure this - if it does, I can't find the documentation.
I initially thought about creating a controller and deriving it from
Umbraco.Forms.Web.Editors.FormController
and creating my own implementation ofGetScaffoldWithWorkflows(string template)
and do some magic routing to get my action method invoked instead of the Umbraco Forms one. Not 100% on the best way of going this, some Googling led me to custom action filters, but I don't want to go down that route.The other thought I had was modifying umbraco.forms.js to call out to my own endpoint that will generate a list of workflows to apply to
$scope.form
in the front-end, but I'm hesitant to do this as it will put the front-end into essentially an "unspported" state due to making customisations, which could have an impact on future updates to Umbraco Forms.Any input on this would be appreciated.
Thanks
I've got a working solution now.
I've created my own controller as follows:
In addition to this, I've updated line 3529 of umbraco.forms.js to call my controller instead of the Umbraco one, and it seems to work!
is working on a reply...