====== StatefulDocumentMessageCollector ======= As part of a CRM project, we integrated the functionality for the [[en:transformation:mappings:funktionen:diffmappingfunktionen:start|DiffMappings]]. For this purpose there is now the function [[en:transformation:mappings:funktionen:diffmappingfunktionen:loadstatefuldocument|LoadStatefulDocument]], with whose help you can get the previous successfully processed version of the same document and then load it. In this context, you can no longer simply use the [[en:prozessdefinition:jobs:jobsteps:allgemein:removemessages|RemoveMessage]] JobStep should delete the old messages, but should do so in such a way that this is not only possible according to time, but also according to the last document instance. All in all, you may have to keep several thousand documents. {{:images:sign_warning.png?nolink|}}**Note:** To delete qualified documents in this scenario, use the JobStep **StatefulDocumentMessageCollector** to collect the messages in scope. Then connect it with the JobStep **[[prozessdefinition:jobs:jobsteps:allgemein:messagedeletor|MessageDeletor]]** and delete the old messages. ====== Usage ======= {{:prozessdefinition:jobs:jobsteps:allgemein:statefuldocumentmessagecollector1.png?nolink|}} ===== Properties ====== {{:prozessdefinition:jobs:jobsteps:allgemein:statefuldocumentmessagecollector2.png?nolink|}} ====== Notes ====== * **MessageBoxName** on which to search * **StatefulEntityTypeName** is the EntityType to search for * **NumberOfDocumentInstancesToKeep** specifies how many successfully processed document instances((This number should be kept greater or equal 1)) * **MinStateToCollect** indicates the status from which a document or message is regarded as successful. The rest is the same as for the MessageCollector The function then collects the messages that contain exactly one document of the entity type. It then determines whether there are older documents of the same type with the same document number. It is sorted by EntryDate in descending order and as soon as the number of "documents to keep" with the same document number is reached, the older instances of the documents or messages are collected and loaded into the job as InputMessages. From there they can be deleted with the **[[prozessdefinition:jobs:jobsteps:allgemein:messagedeletor|MessageDeletor]]** or moved to another MessageBox etc.