CDM "save" operation saves all the linked documents even though they are not modified

Hi all,

In our A12 PMT (Partner Management Tool) project, we have observed strange or unexpected behaviour while saving CDM linked documents.
The CDM document save should ONLY save the modified linked documents (MODIFY_LINK) or new links (ADD_LINK) when saving a CDM document, but instead the save operation, saves all the linked documents in the DB.

For example, I have following situation:
Company-> Employee 1:n relationship.
I have 40 employees linked to the company
I add one more employee to the company
click on “save” button in the CDM form.
The save will save company document, all the 40 employee documents, new employee, new link. Here the 40 employee documents are saved unnecessarily.

Another situation, even if I just save the company CDM form without any modifications company document along with 40 employees are saved even though they are not actually modified.

Is there any CDM configuration that I’m missing? or this is the expected behaviour?

Thanks,
Mokshada

Hey @mokshada-nimble-flood,

is there any Computation within the Relationship Model Elements in your CDM? If so, especially together with transient Fields, this might lead to a value change.

In theory, your expectation is correct. If there was no value change in the child documents/links of a CDM, then there is no respective rpc call for those.

I don’t find this kind of behaviour surprising. How can you be sure that there were no intermittent changes by anyone else to documents the CDM is composed of? By saving the complete CDM document you can be sure that with the save you would get that same CDM document back (if there are no changes from the save operation onward).

Yes there computations in my CDM. But even though I change nothing in the linked documents, should it still make the rpc calls?

If the computations make changes to the linked documents, then it makes sense to persist those changes.

Hey @andreas-fresh-mesa,
although this could also be a valid reasoning, this is not the current behavior.
So in the Standard A12 implementation / the Preview App, only those documents/links that were changed (by the user or a computation or code) do get an RPC request.

This is also in line with the fact that the user opening the CDM might have reading but not writing rights to the child documents. So this user would be allowed to save save changes to the root document, but this would not be possible for this user, if automatically all documents+links would be persisted.

(Moreover the current behavior is also consistent to e.g. the normal form engine. There you could bring the same argument: Maybe somebody else changed the document in the meantime, why not save it there all the time as well?)

Hello, with the “exclude computation rules” setting the issue was solved.

Thanks,
Mokshada