Copied to clipboard

Flag this post as spam?

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


  • Mats Stam 61 posts 210 karma points
    May 02, 2017 @ 14:36
    Mats Stam
    0

    Resetting value of a Umbraco.MultiNodeTreePicker on copy won't take.

    I'm trying to, on copy, to reset a couple of values. Works like a charm on everything but the Umbraco.MultiNodeTreePicker. Anyone else noticed this? And can someone please tell me why it seems like it's just ignoring it when it comes to that specific type of property?

    The code:

    private void ContentService_Copied(IContentService sender, CopyEventArgs<IContent> e)
        {
            //RESET            
            if (e.Original.ContentType.Alias == "productPage")
            {
                e.Copy.SetValue("relatedProducts", null);
                e.Copy.SetValue("featuredFAQs", null);
                e.Copy.SetValue("featuredRetailer", null);
                e.Copy.SetValue("articlePage", null);
            }            
        }
    
  • Alex Skrypnyk 6132 posts 23951 karma points MVP 7x admin c-trib
    May 05, 2017 @ 10:47
    Alex Skrypnyk
    0

    Hi MatsStam

    It should work, do you have right aliases? Maybe some other code that uses events?

    Thanks,

    Alex

  • Mats Stam 61 posts 210 karma points
    May 09, 2017 @ 08:07
    Mats Stam
    0

    No other code that uses events, except on publishing, I check some things. I guess I could try and set the value to something other then null, but not quite sure as to what. empty string brings the same result.

    The version I'm using is 7.5.11 btw, don't think I mentioned that before.

  • Mats Stam 61 posts 210 karma points
    May 16, 2017 @ 11:47
    Mats Stam
    0

    Seems to work just fine when I just copy the one page (do not include the descendants). If I do include the decendants it just doesnt seem to get saved.

    Or could it be me just not seeing something? Just feels like this should work... :/

  • Mats Stam 61 posts 210 karma points
    May 16, 2017 @ 12:18
    Mats Stam
    1

    Actually, I managed to work around it. Changed the event from

    ContentService.Copied
    

    To

    ContentService.Copying
    

    Then it just started working as expected. :P Still seems to be something amiss, but no matter for my purposes :)

    Sorry to bother you all.

  • Alex Skrypnyk 6132 posts 23951 karma points MVP 7x admin c-trib
    May 16, 2017 @ 12:31
    Alex Skrypnyk
    0

    Hi Mats

    Great finding, glad that you fixed this issue! Have a nice day.

    Alex

  • Laurent Lequenne 122 posts 247 karma points
    May 16, 2017 @ 12:38
    Laurent Lequenne
    100

    When it's copied, it means that it's already stored. So you need to save the item.

    When using the copying => you do not need to save the item.

Please Sign in or register to post replies

Write your reply to:

Draft