I found that there was a problem starting the workflow in the document library. When you click on a new document, the word microsoft will open in this example. You write material to a document and save it in the library. The library-related workflow, in this case the home approval workflow with start to run now that the list item has been created. However, the problem is that the document is still open and thus checked until the user closes the word. If the first thing the workflow does is set some of the other fields in this list item, for example, to set the approval status to “pending,” then this will result in an error. These are errors because the document has been uploaded.
I tried to get the workflow to wait for the document to be verified, but this is where I fail. I try to activate OnWorkflowItemChanged also in the code verifying that the change was that the document was checked, so after that I can continue to work with the rest of my workflow. The problem is that this activity does not seem to perceive the validation event as a change. This makes sense because closing a document that automatically validates it does not actually change any of the element's fields.
So I need to find some way inside my workflow to detect the validation event, but until I wait.
source
share