Convert EPiServer Form to XForm

You must get rid of your Form-properties and convert them to EPiServer XForm before you can migrate them to EPiServer 5.

You can easily identify all form-properties on you site with some SQL:

SELECT pt.pkID AS PageTypeId, pt.Name as PageType, pd.Name AS PropertyName, pt.Filename
FROM tblPageDefinition AS pd
INNER JOIN tblPageType AS pt ON pd.fkPageTypeID = pt.pkID
WHERE (pd.fkPageDefinitionTypeID = 9)
ORDER BY pt.SortOrder, pd.FieldOrder

imageIn admin mode there is a XForm Convert tool that can be used to convert existing Forms into XForms.

One of the differences between Forms and XForms is that the data for a Form is stored on a page but XForms are stored as a separate object in the ObjectStore.

The XForm property on you page only stores a GUID in a string that is a reference to the real XForm instance.

Do not change the type on an existing property from Form to XForm. That will only give you exceptions. Instead, create new properties and delete the old ones.

If you want better control over the conversion process use Lutz Reorder’s reflector to reverse engineer the class EPiServer.Admin.ConvertFormToXform in EPiServer.CodeBehind.dll.

Bookmark and Share

Tags: , , , ,

  1. Dominik Juszczyk’s avatar

    One thing that should be mentioned. When you convert forms from the old format to the XForm format, the posted data will not be converted. One should export the old data to Excel if one want to keep the old posted data.
    Also I had some problems with this default xform converter when upgrading from 4.41 to 4.61. I asked about it someone from episerver and they had sent me other convert tool that worked much better.

    Reply

  2. Fredrik Haglund’s avatar

    Dominik, yes I forgot that posted data is not converted. Thank you for mentioning that!

    The code you got from EPiServer earlier is probably the same code as in ConvertFormToXform class mentioned above, at least in release 4.62B according the EPi support staff.

    Reply

  3. Jørgen Helgheim’s avatar

    Thanks for this info.

    I want to add a sql script that is useful to use if you want to get hold of a pageid list of all pages in the EPiServer solution that uses the old form property:

    SELECT [fkPageID] as PageID
    FROM [tblProperty]
    INNER JOIN [tblPageDefinition] AS pd ON [tblProperty].fkPageDefinitionID = pd.pkID
    WHERE pd.Name = ‘MainForm’

    This is useful if the old form property (in my case ‘Mainform’) is used on multiple pagetypes.

    Reply