Trigger form Submit event through Visual studio

Joy Basak asked on April 26, 2017 14:23

Hello ,

I was trying to implement form autoresponder but after insert the data in form (through visual studio) i'm not getting any autoresponse mail.But if i insert the data from kentico CMS portal im getting the autoresponse mail. I guess the reason is - while inserting the data in form (through visual studio) the form submit event is not invoking .Is there any API to do the same.Please help me to fix the issue .here is my code

        DataClassInfo formClass = DataClassInfoProvider.GetDataClassInfo(formobject.FormClassID);
        string formClassName = formClass.ClassName;
        BizFormItem newFormItem = BizFormItem.New(formClassName);                                                  
        newFormItem.SetValue("FirstName", fisrtName);
        newFormItem.SetValue("LastName", lastName);
        newFormItem.SetValue("Zip", pinCode);
        newFormItem.SetValue("Email", EmailId);
        newFormItem.SetValue("CouponValue", CouponValue);
        newFormItem.SetValue("ExpiryDate", CouponExpiryDate);
        newFormItem.SetValue("CouponCode", CouponCode);
        newFormItem.SetValue("PolicyCheck", policyCheck);
        newFormItem.SetValue("EMailCampaignSelector", EMailCampaignSelector);
        newFormItem.Insert();

Thanks and regards Joy

Recent Answers


Brenden Kehren answered on April 26, 2017 14:41

Try using this instead

BizFormItemProvider.SetItem(newFormItem);

0 votesVote for this answer Mark as a Correct answer

Joy Basak answered on April 27, 2017 06:07

Hello Brenden previously i tried with same ..but still i did'nt get any autoresponder mail .I think the form submitting event is not invoking at all .

0 votesVote for this answer Mark as a Correct answer

Brenden Kehren answered on April 27, 2017 15:38

If you're using your own form, you'll have to create that email and send it yourself. If you're using the BizForm control i.e.:

<cms:BizForm ID="viewBiz" runat="server" IsLiveSite="true" />

Then you can use something simple like the methods below:

viewBiz.SendConfirmationEmail()
or
viewBiz.SendNotificationEmail()

1 votesVote for this answer Mark as a Correct answer

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