Copied to clipboard

Flag this post as spam?

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


  • Gambit 20 posts 100 karma points
    Feb 16, 2018 @ 08:15
    Gambit
    0

    RecordImportingEventHandler has null as 'sender'

    Hello,

    We have updated CMSImport package from v3.5.3 to v3.7.4 and we got the issue during "RecordImporting" Event. The sender comes as "null" enter image description here

    We are using it quite active there. Was it removed deliberately, because I haven't found anything of the sort in the Release Notes?

    Thank you

  • Richard Soeteman 4046 posts 12899 karma points MVP 2x
    Feb 19, 2018 @ 07:19
    Richard Soeteman
    0

    Hi,

    This is because the sender is null in Umbraco since v7.x It should only be null with new items.

    Hope this helps a bit.

    Best,

    Richard

  • Gambit 20 posts 100 karma points
    Feb 22, 2018 @ 09:21
    Gambit
    0

    Hello Richard,

    This is because the sender is null in Umbraco since v7.x It should only be null with new items.

    However, when I'm using Umbraco v7.7.9 with CMSImport v3.5.3 the "sender" property is not a null but a proper IContent object. And for us it's very convenient because "RecordImporting" had sender as an "IContent" object which is not yet published, it's properties can be easily changed, and they will be saved during "ContentService.Saving" event.

    I have tried to create an artificial field with data and an artificial mapping for this field: e.Items.Add("artificialField", someData); e.ImportState.Mapping.Add("IContentProperty", "artificialField"); But it made things much worse - after two or more runs, "RecordImporting" remember the mapping but it's DataProvider become null. And "ContentService.Saved" is triggered before the value is mapped to the property. Therefore I have abandoned this idea.

    Eventually, We had to revert all changes from v3.7.3 back to the v3.5.3 due to this breaking change. Do I understand correctly that v3.5.3 use obsolete Umbraco's methods and that's why we are getting "null" as an object for new content and this new functionality is set in stone and you don't plan to change it back?

    Thank you

Please Sign in or register to post replies

Write your reply to:

Draft