Kentico 8: API Examples - Form Records

Tim Spring asked on April 22, 2014 06:56


I'm trying to find examples of API code for form record manipulation in Kentico 8.

Particularly the Add, Update and Delete records examples as in the Kentico 7 documentation:

I've tried searching the new Kentico 8 documentation and looking in the installation API example folder: /CMSAPIExamples but there doesn't seem to be any examples relating to form records.

Do any of these examples for Kentico 8 exist? Using the previous Kentico 7 code examples (as above) no longer work in Kentico 8.

Thanks, Tim

Recent Answers

Brenden Kehren answered on April 22, 2014 09:20

Hey Tim, take a look at a few of the Articles talking about API and Form changes.

I haven't found any documentation on the API Examples either for Forms but you can also check out the API documentation here:

I think the namespace you're looking for is the CMS.OnlineForms namespace vs. BizForms. Also pay attention to the Provider library, this was updated with the DataQuery library now. Take a look here:

0 votesVote for this answer Mark as a Correct answer

Yehuda Lando answered on April 22, 2014 09:21

I didn't test this, but with a couple changes, the original example works: DataClassInfo dci = DataClassInfoProvider.GetDataClassInfo(bfi.FormClassID); BizFormItem formRecord = BizFormItem.New(dci.ClassName);

1 votesVote for this answer Mark as a Correct answer

Tim Spring answered on April 22, 2014 12:51

Thanks for the pointers. I tried Yehuda's suggestion and it made the Insert record function work in my custom code, so I hope it'll be the same for Update & Delete.

Another form API problem I'm having is you used to be able to update a fields data in a current form (for example during an OnAfterValidate event) even if the field wasn't included in the form layout/edit-form by using:

viewBiz.BasicForm.Data["fieldname"] = "newdata";

This doesn't seem to work now.

I assume I should be using:


But there's no documentation on how to use it, only GetDataValue, which I can get to work fine. All I get when I try to use SetDataValue is the EventLog error:

CMS.FormControls.AbstractBasicForm.SetDataValue(string, object)' is inaccessible due to its protection level

I'm not sure why, I'm using it in the same section of code as the GetDataValue which works ok.

Should I be setting form field data, that's not included in the layout/edit-form another way?

Thanks, Tim

0 votesVote for this answer Mark as a Correct answer

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