Copied to clipboard

Flag this post as spam?

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


  • Remi Martel 32 posts 104 karma points
    Apr 20, 2018 @ 18:12
    Remi Martel
    0

    Event Saved. How to get value being saved

    I'm creating a Saving Content event that fires when I save a documentType with a multinode treepicker. I want to be able to cancel the save and/or publish if the item selected with the picker has the same id as XXXX. The thing is when I try to loop the multinode treepicker it's empty.

    here is my code:

                            foreach (var item in schedule.Items)
                                {
                                    foreach (var currentItem in ((Umbraco.Web.PublishedContentModels.Schedule)page).Items)
                                    {
                                        if (item.Id == currentItem.Id)
                                            exist = true;
                                    }
                                }
    

    This double foreach is in a function where I pass the 'page' from
    foreach(var page in e.SavedEntities). I also used IPublishedContent iPublishedPage = umbracoHelper.Content(page.Id); to change get 'page' as an IPublishedContent (castable to my the model.generated of my documentype) instead of an IContent

  • This forum is in read-only mode while we transition to the new forum.

    You can continue this topic on the new forum by tapping the "Continue discussion" link below.

Please Sign in or register to post replies