This project is read-only.

Difficulty importing data to custom content types using the Import Export module

Topics: General
Jun 15, 2015 at 3:32 PM
Edited Jun 16, 2015 at 9:38 AM
In our DataMigration class we create a table called OrchardMsg. We're trying to use the Import Export module to bulk insert data into the table but it's not quite working.

We have classes

class OrchardMsg : ContentPartRecord and OrchardMsgPart : ContentPart<OrchardMsg>, ITitleAspect. OrchardMsg content type has an IdentityPart.

Both classes have two properties Code and Text. Through the Orchard admin section we create an OrchardMsg and this is successfully saved to our custom table.

Using the Import Export module we export OrchardMsg and the resulting <Data> node looks like this:

<OrchardMsg Id="/Identifier=488336ae57354a99b8dc64ec37bfff81" Status="Draft">
  <IdentityPart Identifier="488336ae57354a99b8dc64ec37bfff81" />
  <CommonPart Owner="/User.UserName=SPAdmin" CreatedUtc="2015-06-15T13:48:19.6950396Z" ModifiedUtc="2015-06-15T13:48:19.8310426Z" />

As you can see there is no <OrchardMsgPart> (thus nowhere to set the two properties) as we expected to see after following this example:

We tried to manually insert this inside the <Data> node with
<OrchardMsgPart Code="0020" Text="Booking Ref doesn’t exist for the customer" />
When we imported the file it ran successfully, added a record to our custom table but the fields, Text and Code, were null.

Is there something missing between OrchardMsg and OrchardMsgPart?

Any help much appreciated.