This article describes how to clone Bizform's data programmatically.

Most of the objects in Kentico CMS (if not all) have class information stored in the CMS_Class table where you can find form definition represented by the xml structure (ClassFormDefinition column) of your BizForm. 

Of course the second important part of the class is xml schema (ClassXmlSchema column) representing data structure of the BizForm table.

First of all, it is necessary to create a new record in this table (CMS_Class) by copying the original BizForm class record and modifying the form definition and xml schema to match the new BizForm as well as to copy all other related class objects, for example alternative forms, queries etc. 

As for the second step, we need to create a BizForm table by copying the original BizForm column/s, its data type and length.

The next step would be to create a BizForm object in the CMS_Form table and, finally, to copy the BizForm data (optional). 

Since Kentico CMS comes with extensive API support, these operations can be managed with usage of default classes. While following the ensuing steps you will be able to add a BizForm clone UI page to your solution which contains some example code for cloning BizForms and BizForm data:


1.) Update the following files with those from the attached zip package:

~\CMSModules\BizForms\Tools\BizForm_List.xml
~\CMSModules\BizForms\Tools\BizForm_List.aspx.cs
~\CMSModules\BizForms\Tools\BizForm_Clone.aspx.cs
~\CMSModules\BizForms\Tools\BizForm_Clone.aspx

(for version 5.x) BizFormClone.zip file: download
(for version 6.x) BizFormClone_6_0.zip file: download
(for version 6.x with hotfix no.9 and later) CloneForm+6.0.9.zip: download

2.) Add custom clone icon to following location:

~/App_Themes/Default/Images/Design/Controls/UniGrid/Actions/CloneObject.png

Example icon: download

3.) Add the following resource strings to your resource string file (/CMSResources/CMS.resx):

Name Value
BizForm.Progress BizForm is being cloned ...
BizForm.CopyData Copy data
BizForm.Clone Clone BizForm
BizForm.BizFormNotFound BizForm not found.
BizForm.CloneIntro You are about to clone the <strong>{0}</strong> BizForm. Please enter the display, code and table names.
BizForm.CloneError Error while cloning BizForm <strong>{0}</strong>. Original exception: {1}
BizForm.CloneFinish <strong>{0}</strong> BizForm was successfully cloned.
General.Clone Clone
Unigrid.Actions.Clone Clone object


4.) Restart your application from CMS Site Manager -> Administration -> System section in order to re-load resource strings.

At this point, you will be able to clone your BizForms and BizForm data via the UI of CMS Desk (CMS Desk -> Tools -> BizForms -> Clone object).


  -mr-

 

 



See also:


Applies to: 5.x, 6.x
Created on 6/18/2011 5:28:03 PM in Forms (BizForms)
 
1 rating
Sitemap | Content Management System | E-commerce Software | Social Networking Software | Intranet | Online Marketing Solution | Copyright © 2004-2013 Kentico Software | Powered by Kentico CMS