Trouble saving changes for a widget in a deeply nested FlowPart during migration. #9885
-
I have a form with many nested flow parts to split things up between form steps, fieldsets within a step, and fields within a fieldset. Display/Edit/Update all work fine, but now I want to do a migration that will 1) update the content definition of one of the "field" content item widgets and 2) iterate through all instances of that item in forms and modify its JSON data. I can manage to iterate through the items and update their JSON data (verified by inspecting the I use Any ideas what I could be doing wrong? Edit: I also tried creating a new content item, merging the data over, applying the changes, and then using the function, but that legitimately makes a new item entirely rather than updating the existing one, even though I ensured the ContentItemId was the same, so not sure how to do it properly. |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 4 replies
-
Are you missing a call to |
Beta Was this translation helpful? Give feedback.
-
I finally figured this out. Only took me a few hours of experimentation, source code analysis, and annoyance. XD First, it looks like I have to assign a new Second, I needed to properly create a new row in the database just like the update operation does in the form. To get that to work as intended, I had to use Hope this explanation helps someone else down the road. |
Beta Was this translation helpful? Give feedback.
I finally figured this out. Only took me a few hours of experimentation, source code analysis, and annoyance. XD
First, it looks like I have to assign a new
List<ContentItem>
to the set of widgets on the FlowPart in order for it to properly recognize that theWidgets
property has changed. If I just inline modify the Widgets in question, it doesn't appear to actually update the nested data. So, I assigned the widgets to themselves with aSelect(...)
statement via LINQ, remapping the widgets I needed to change as needed. This ended up being simple for the higher up FlowParts (steps, fieldsets) since they just returned the same ContentItem, whereas the deepest FlowPart (for field widgets) ne…