has anyone of you experience with editing multiple relationship properties directly from a Form?
I have an ItemType with a couple of sub relationships, something like this:
I don´t want the users to have to click through all the relationship levels, so I want to provide an alternative rendering of ALL levels inside a Form. I want to completely hide the relationships later.
Display all the data at once is not a problem. We can use fetch/getRelationships to get the individual levels when user open the Form and then display the data. I right now use a simply table rendering that groups the different levels.
Some of the cells in the table are (custom) dropdowns where use can select values that shall later be stored in the corresponding relationship.
I am right now struggle to find the best way to update the relationships without using too much individual queries.
One working solution was to fire an edit query each time user change a cell value. But this one will fire a lot of events.
I think a better way would be just edit the existing context item and then store the updated values in the database once the users clicks "Save".
Editing the context item / document.thisItem some kind of works, but the values will not be stored reliable. I tried this one:
// Get the relationshps from level 1
var NullRel1Items = document.thisItem.fetchRelationships("MyTopItemType").getRelationships("NullRel1Item");
// Edit one single relatiionship from level 1
This variant works from a button event. It will not live-update the relationships, but store the new value when users click save. But I have to fetch the main item including all relationships every time again and again. I weren´t able to reuse the current context item. So this variant hadn´t worked when fired from multiple cells.
Does anyone know a working variant to edit relationships? I know that Aras does similar editing inside Innovator. But have haven´t find a easy to reuse sample yet. So any hints would be welcomed!