Hello everyone,
i would like to attach a group to a group with operation ‘PARTIAL_MODIFY_DOCUMENT’ but this runs into an error. I using DocumentPart:
DocumentPart attachDocumentPart = new DocumentPart(attachPath, attachDocument, documentUtils.getRepetitions(attachPath));
documentService.update(
new DocumentReference(attachDocumentReference),
List.of(attachDocumentPart),
Locale.GERMAN);
Exception:
com.mgmtp.a12.kernel.md.document.api.services.DocumentSerializationException: Following errors were found:
Group '/Group[1]/Group[1]/AttachGroup[1]' was wrongly instantiated as field.
There was a similar question Using PARTIAL_MODIFY_DOCUMENT to append an entry to a repeatable group, could you please check if it does any help 
Hi, unfortunately not, I checked this post before I opened this thread
In conclusion, how can I attach a group to a group in version 2023.06?
Found a Solution:
private List<DocumentPart> createDocumentPartsFromAttach(
IDocumentService attachDocService,
String attachPath,
String status) {
List<DocumentPart> documentParts = attachDocService.getDocument().getEntityInstances().stream()
.filter(IFieldInstance.class::isInstance)
.map(instance -> createDocumentPart(instance, attachPath))
.collect(Collectors.toList());
documentParts.add(new DocumentPart(
ATTACH_STATUS_PFAD,
status,
documentUtils.getRepetitions(ATTACH_STATUS_PFAD)
));
return documentParts;
}