In 2025.06, what's the replacement for DocumentUtils.setSingleValue()?

To change a value in a document in data services we used to use DocumentUtils.setSingleValue(). This doesn’t cut it any more. Neither does DocumentV2Utils. So, what would be an easy way to accomplish this in 2025.06?

You can use the respective Kernel APIs directly.

This is an example from the Kernel documentation…

DocumentV2 updatedDocV2 = docV2.withFieldValue("MyGroup[2]/myField", "myNewValue");

Thanks, gonna try that. Unfortunately, I can only tell you whether it works after I’ve made all the red in my IDE disappear.

The method name is a bit questionable, tho. :person_shrugging:

Moin @juergen-smooth-ice,
our DocumentV2 Tutorial is also live now and you can check it out to receive a first experience in using the new API.

Especially the following section is interesting in how to apply updates to the, now immutable, document and how to handle multiple document updates: GetA12 Login.

That is helpful. And it answers my question whether or not the ".with()"-methods create new instances. I guess that’s also true for ".with()"-methods on FieldInstanceV2

Yes, the .withXY()-methods of the new DocumentV2 API (including all V2 interfaces) will always return the original object with the corresponding adjustment (e.g. removal or addition) as a new object.