Copied to clipboard

Flag this post as spam?

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


  • Michael B 17 posts 97 karma points
    Jun 21, 2024 @ 21:47
    Michael B
    0

    IcontentService.SetValue not changing value of the Property

    Hello,

    This is Umbraco v10.8+.

    I have a nested content list that I wanted to update based on input from the backoffice when someone publishes a node. Essentially, they publish the node, and a Notification event fires off and updates a nested content list somewhere else with information from the new node. Nothing too crazy.

    I pull down the existing nested content into a List<Dictionary<string,string>> by parsing it with JsonConvert.DeserializeObj, which works. It then adds another json item to the list that is modeled from the new object that started the Notification event, so the json structure is correct. Once the new object is in the list, it serializes the updated nested content list back into json and then calls IContent.SetValue("propertyName", serializedJson) to update the node.

    The problem is, I get no error message, and the value is not updated in the IContent node. If you add a check such as IContent.IsDirty() or IContent.IsPropertyDirty("propertyName") both return false. I am not sure why this is happening, but there are no exceptions to work with so I am a bit lost. Any ideas are welcome, and if I can supply any information I'd be more than happy to.

Please Sign in or register to post replies

Write your reply to:

Draft