I'm creating a document with object creator copy rule and let it convert to pdf via state action.. Problem is that the document isn't filled.. Is this normal behaviour?
I'm creating a document with object creator copy rule and let it convert to pdf via state action.. Problem is that the document isn't filled.. Is this normal behaviour?
It is an excel sheet with M-Files properties.. It seems like the document is not filled/opened before converted to PDF..
It might help if you make sure the document is actually checked in before it is converted to PDF. If you a workflow with automatic transitions then the document will not be checked in before the last state in the line of automatic transitions. I have often placed a pause in flow with a script comparing the last modified time stamp to current time and setting a minimum difference to a few minutes. This will make the transition wait til next time the server checks, and your document is checked in. That should force filling of the properties. The downside is that you have to wait for up to an hour for the PDF version unless you reduce the interval on the server.
Couldn't you simply create another state which checks in the file via script before the state which converts the file to pdf?
If I recall right by default the values are filled in the template only when the user opens the document in Office so in case the file is never opened by the user before the PDF conversion (ie. it only moves in the workflow) then see if this option would help: Enabling Metadata Field Updates for the Classic M-Files Web and M-Files Mobile (it says web and mobile but the filling is done on the server during check-in so should work with any client)
It's also possible to call the VaultObjectFileOperations.UpdateMetadataInFile method in the API explicitly in the workflow before the PDF conversion to have the values filled in.
I already have this option activated for Word and Excel Extensions, but no effect in this case.. Calling VaultObjectFileOperations.UpdateMetadataInFile method in a separate state before the pdf conversion state works if I send the object in this state manually.. But with my copy rule the result is a pdf with no properties filled in..
That is my point - if using automatic rules/transitions the document does not get checked in and the placeholders in the document do not get filled unless you add a pause in the process to force a check in. When you do it manually it works because the document gets checked in.
There is a script in this topic: community.m-files.com/.../10703
You are absolutely right but this does not help if you need to do further tasks with the file immediately.. But can I check in the file via script to workaround this?
Interesting thought. I believe it can't be done because the object is checked out in order to run the workflow action. You would be cutting off the branch that you are sitting on.
Perhaps Craig Hawker has an idea?
And If I give the document a boolean property "Convert PDF" and add an eventhandler which checks this property after document checkin and if it is true initiates the conversion? Then you could set this property at through different ways (metadata card, object creator, automatic properties, workflow states) and voila
Β© 2025 M-Files, All Rights Reserved.