Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Sjoerd Stottelaar 31 posts 189 karma points
    Jun 12, 2019 @ 09:11
    Sjoerd Stottelaar
    0

    Send queryparameter to thank you page

    Is it possible in UmbracoForms to send a query parameter to the thank you page? For instance, I want a hidden field to be sent to the thank you page (/form/thankyou?field=xxx) so that I can track it with Google Analytics. Does anybody know if this is possible?

    Thanks in advance!

  • Yakov Lebski 591 posts 2346 karma points
    Jun 19, 2019 @ 21:18
    Yakov Lebski
    0

    You can create a custom workflow and control your redirection parameters

  • Sjoerd Stottelaar 31 posts 189 karma points
    Jun 20, 2019 @ 06:11
    Sjoerd Stottelaar
    0

    Thanks! Did not know this, going to look into it.

  • Yakov Lebski 591 posts 2346 karma points
    Jun 20, 2019 @ 06:41
    Yakov Lebski
    2

    Workflow for example - redirect to first child node under form page

     public class ChildThankYouPage : WorkflowType
    {
        public ChildThankYouPage()
        {
            Name = "Child Thank You Page";
            Id = new Guid("4DE6729C-9808-4FFE-A668-8C67A0D98C6C");
            Description = "Redirect to child page with thank you message";
        }
    
        public override WorkflowExecutionStatus Execute(Record record, RecordEventArgs e)
        {
            try
            {
                var helper = new UmbracoHelper(UmbracoContext.Current);
                var page = helper.TypedContent(UmbracoContext.Current.PageId);
                var thankYouChild = page?.Children.FirstOrDefault();
                if (thankYouChild != null)
                {
                    HttpContext.Current.Response.Redirect(thankYouChild.Url);
                }
            }
            catch (Exception ex)
            {
                LogHelper.Error<ChildThankYouPage>($"Workflow Error:", ex);
                return WorkflowExecutionStatus.Failed;
            }
    
            return WorkflowExecutionStatus.Completed;
        }
    
        public override List<Exception> ValidateSettings()
        {
            var exceptions = new List<Exception>();
    
            return exceptions;
        }
    }
    
Please Sign in or register to post replies

Write your reply to:

Draft