How we can redirect to the another page in custom Form Handler Module?

Quan Lee asked on June 7, 2022 12:33

Hi folks, I have a custom Module to handle the form's data after insert. Basically, I will submit data to Salesforce then receive and the URL from Salesforce response. And I want to redirect the current page to the URL.

Many thanks for your help!

 private void FormItem_InsertAfterHandler(object sender, BizFormItemEventArgs e)
        string SalesForceOID = SettingsKeyInfoProvider.GetValue($"{SiteContext.CurrentSiteName}.{Constants.SalesforceConfigs.SalesforceOID}");

        // Gets the form data object from the event handler parameter
        BizFormItem formDataItem = e.Item;
        string[] excludedFields = Array.ConvertAll(SettingsKeyInfoProvider.GetValue($"{SiteContext.CurrentSiteName}.{Constants.SalesforceConfigs.ExcludedFormFields}").Split(','), p => p.Trim());
        // Checks that the form record was successfully created
        if (formDataItem != null)
            var submitData = new StringBuilder();
            submitData.AppendFormat("oid={0}", SalesForceOID);
            foreach (var item in formDataItem.ColumnNames)
                if (Array.IndexOf(excludedFields, item) == -1)
                    var fieldData = formDataItem.GetStringValue(item, "");
                    if (!string.IsNullOrEmpty(fieldData))
                        submitData.AppendFormat("&{0}={1}", item, fieldData);
            var result = PostWebToLead(submitData.ToString());
            //I want to redirect to the new page in here

Recent Answers

Dmitry Bastron answered on June 10, 2022 15:52

Hi Quan,

I guess you are using Form Builder. I don't think it's possible to implement it like that in the Event Handler, I think you'd just need a custom controller to process this form submission with your custom code.

0 votesVote for this answer Mark as a Correct answer

   Please, sign in to be able to submit a new answer.