How to prevent the computed value from being cleared once the condition no longer matches?

Hi @huyen-gentle-brush

A lot of your question relates to how computation rules are evaluated in the backend. The change in behavior that you have seen probably comes from one of two things.

  1. Kernel deprecated IDocumentComputationResult#apply(Consumer) and IDocumentComputationResult#apply(IDocumentFactory, Consumer). You are now recommened to use IDocumentComputationResult#applyTo(IDocument) and IDocumentComputationResult#applyTo(IDocument, IDocumentFactory) instead. There is a difference in these methods though as “applyTo” clear the field instances that are unfilled after the computation. See here.
  2. Data Services added a setting in 2024.06-ext2, mgmtp.a12.dataservices.documents.computation.cleanup-error-and-not-computed-value.enabled, to allow you to recompute fields to null. Check out Empty String when no calculation applies for a discussion of that optional setting.

If your issues relate to either of these settings, please create a new thread in the Kernel or Data Services category.