Troubleshooting document visibility issues in CDM after programmatic creation of Document

I have a DM named “Role-DM” and another named “Role-CDM-DM”. When I create the “Role-DM” document programmatically, I cannot see that document in the Role CDM list. However, after restarting, I can see it in the CDM list.

I use the following code to create the document programmatically:

documentService.create(newRole, null);

I also have similar DMs, “Person-DM” and “Person-CDM-DM”. When I create the “Person-DM” document using forms (not programmatically), I can immediately see the newly created person in the Person CDM list.

I compared the logs and observed that when creating a document using forms, some indexing tasks are performed. Perhaps I need to trigger an indexing task after creating the document programmatically. If so, could you please advise how to trigger indexing for the specific document? If not, what could be the cause of the issue mentioned above?

Actually, indexing is already included in the “documentService.create()” method.

I was able to make the Role visible in the Role CDM list using the following code:

cddDirtyDocumentsConsumer.process(roleDSD.getDocRef());

However, I’m uncertain if this is the correct approach to address the issue mentioned above. Could you please advise on the proper way to resolve this problem?

Hello,

do you have CDD processing to be configured as asynchronous or synchronous? In production it should be asynchronous, which means that the CDD creation is delayed. You can check logs when the document is processed.

But calling com.mgmtp.a12.dataservices.document.persistence.internal.DefaultDocumentService#create is correct and it handles either indexing, and also dirty documents (CDD) processing.

Hi @n.garryyev,

did you find the response helpful or should the question remain open for more clarifications? If the response answered your question, please mark it as the solution via the checkbox-icon.
Thanks ahead for your feedback and have a nice rest of the day!

Best,
Denise from the Discourse Team