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.
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 } }
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.
Please, sign in to be able to submit a new answer.