Using PARTIAL_MODIFY_DOCUMENT to append an entry to a repeatable group

We are using PARTIAL_MODIFY_DOCUMENT to change specific fields in existing documents. As those fields are not repeatable, providing the necessary “repetitions” array was straight forward.

Now we have the requirement to append an entry (consisting of multiple fields) to a repeatable group - but as the document is not loaded, we have no idea if that group already exists and how many entries it contains. I can’t figure out what the repetitions array in that case should look like. I can not read the document to calculate the current length of the repetitions.

So my question is: how can I create a DocumentPart that specifies “append these values to the end of the group” without knowing how many elements the group currently contains (or if the group already exists at all).

Does the lack of an answers mean, this is not possible?

Hi Thomas,

I’m sorry for the late answer. Currently there is no such heuristic to add fields to dynamic position. Whatever is in the request is just passed into kernel’s com.mgmtp.a12.dataservices.utils.internal.DocumentUtils#findSingleEntityInstance(java.lang.Class<T>, java.lang.String, int[], com.mgmtp.a12.kernel.md.document.api.services.IDocumentSearchService) to handle it.

In javadoc they refer to IDocumentSearchService: @param repetitions repetitions determining position of entity. @See {@link IDocumentSearchService}

Thanks for the answer.

So the only workaround is to load each document that needs to be modified, calculate the necessary index and use that when sending the partial modify.

How are the chances that a feature request to support this would be accepted and implemented?

Hi @thomas-soft-grove,

Changes are very good that the ticket will be accepted. If the kernel provides this functionality, DS will just use it and then PARTIAL_MODIFY_DOCUMENT will have support for this. Implementation of this feature is still up for the planning, but my understanding is that the most of the work needs to be done in kernel, so I have asked Kernel team to take a look at this thread and they will respond shortly.

Maybe the functionality is already present in DocumentV2 version which will be integrated to DS in 2025.06.

I think DocumentV2#withGroupRepetitionAppended (javadoc) does this on the kernel side.

I have created the ticket A12-16466

Let me know if I should add more information