Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Neil 3 posts 73 karma points
    Jun 09, 2021 @ 20:08
    Neil
    0

    CmsImport with Block List content

    I'm using CMSImport to take content from a legacy site and import it into Umbraco 8. I've created a FieldProvider to allow me to successfully create block list content. All good so far.

    The issue I'm running into is that the data file being used for the import has the content I need for a single piece of block list content in two separate csv fields. So the title for my block list content might be in field1 and the Description in field2.

    I therefore need a way of seeing other import data fields within my FieldProvider so I can add the required values in one go.

    At the moment there doesn't seem to be any way of seeing other row data.

    Is there a work around?

    One solution I've also tried is using the RecordImporting event to modify and combine some of the fields in the row but this doesn't seem to persist... when the data reaches the FieldProvider it is back to its original form.

    I could ask for the data to be exported differently but that doesn't seem like the correct solution as the exported data does represent the structure correctly from the legacy site.

    Any help would be appreciated!

  • Neil 3 posts 73 karma points
    Jun 10, 2021 @ 14:12
    Neil
    0

    As a workaround at the moment I'm using HttpContext.Current.Items to store the import values in RecordImporting event... then using them in my FieldProvider... and then disposing of them in the RecordImported event. Probably a better way to do it but works great for now.

  • Richard Soeteman 3908 posts 12191 karma points MVP
    Jun 11, 2021 @ 09:27
    Richard Soeteman
    0

    Hi,

    RecordImported allows you to get the values and save the Umbracodocument again. Not most efficient but will do the trick.

    Best,

    Richard

  • Neil 3 posts 73 karma points
    Jun 11, 2021 @ 09:31
    Neil
    0

    Thanks for the response Richard.

    At the moment seeing all the row data in the FieldProvider is the most straightforward for my use case so the workaround I posted works OK. The reason for that is that I can map a single column out of my csv to trigger the creation of a block list item but then in the same method make sure I can fill all the other required properties at the same time.

    I'll bear in mind your solution so thanks for that.

    I have a working method now of importing Block list and its nested elements using CMSImport so for me that makes the possible use cases for your plugin much larger! Thanks for developing it.

    I'll try and post the solution when it gets neatened up!

Please Sign in or register to post replies

Write your reply to:

Draft