Make your custom component compatible with Redirect to Url action

A while ago, I received a question from Joshuwa Jenskins on how the value of the hidden fields component (from Sitecore Forms Extensions) could be made available in the “Redirect to Url” action added in Sitecore 9.3.

After a bit of research, the answer proved to be rather easy.

First of all, your custom component (like the hidden fields component) needs to have a value field. This should be the case when your component model inherits from Sitecore.ExperienceForms.Mvc.Models.Fields.InputViewModel class.

The second step is to tell the Redirect to Url save action that your component should be available in the dropdown list. The form field dropdown is dynamicly filled with all fields on your form that are made out of supporting components.

To add your component to that list, you need to switch to the core database. Navigate to the item /sitecore/client/Applications/FormsBuilder/Components/Layouts/Actions/RedirectToUrl/PageSettings/FormClientApi. This item holds the configuration of the datasource behind that form field.

On this item there is a field “IncludedFieldTypeIds”. Just add your custom component to the list, ├ęt voila, your component will now be available in the Redirect to Url action.

Leave a Reply

Your email address will not be published. Required fields are marked *