1

I have a Sitecore Form in which post submission it redirects to success page so now we want Single Form to be used for Multisite structure in Sitecore.

Currently Sitecore Forms provides only one page to configure for Redirect to Page action method. Is there a way to customize Redirect to Page/Redirect to Url action method to be able configure multiple success page and based on current domain redirect to configured success page of specific site?

Please let me know alternate solutions if any. Thankyou.

1 Answer 1

2

I think a custom submit action might be needed. All information on how to do that can be found in the official docs: https://doc.sitecore.com/xp/en/developers/103/sitecore-experience-manager/walkthrough--creating-a-custom-submit-action.html. I will assume it is not worth copying that here.

Could be a bit tricky to find a way to define the page to redirect to across all the sites - but that is actually more a functional question and will rely on your content structure.

As an example, this is what the ootb redirect to page looks like (or at least the execure function):

protected override bool Execute(RedirectActionData data, FormSubmitContext formSubmitContext)
    {
      if (data != null && data.ReferenceId != Guid.Empty)
      {
        Item obj = Context.Database.GetItem(new ID(data.ReferenceId));
        if (obj == null)
        {
          return false;
        }
        ItemUrlBuilderOptions urlBuilderOptions = this.LinkManager.GetDefaultUrlBuilderOptions();
        urlBuilderOptions.SiteResolving = new bool?(Settings.Rendering.SiteResolving);
        formSubmitContext.RedirectUrl = new UrlString(this.LinkManager.GetItemUrl(obj, urlBuilderOptions)).ToString();
        formSubmitContext.RedirectOnSuccess = true;
        formSubmitContext.Abort();
        return true;
      }
      return false;
    }

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.