SharePoint Designer Workflows Trigger before Properties Are Set
Another post from our ‘customer support archives’. We’ll call this one ‘The case where custom properties were not copied to the converted PDF file and why it was not our fault’._
We were contacted by a SharePoint developer who is using our PDF Converter to automatically convert a file to PDF format as soon as it is uploaded to SharePoint, a common requirement. However, it appeared that the custom properties specified on the source document were not copied over to the PDF file, even though this feature was specifically enabled.
After a brief investigation the following came to light:
-
On Document Libraries that do not require an explicit check-in, workflows are triggered as soon as the file is uploaded, before the custom properties are filled out.
-
Filling out the properties directly after the file has been uploaded does not retrigger the work flow.
In other words, the workflow and associated PDF conversion process was triggered before the properties were set so it appeared they were not copied over.
This is all very inconvenient, fortunately there are a number of workarounds that you can apply:
-
Use the ‘Pause for duration’ workflow activity and periodically re-check if the properties have been filled out. Your mileage may vary as this activity is known to be very buggy.
-
Change the settings on the Document Library and require explicit check-ins. With this feature enabled the workflow waits until the check-in has taken place (after setting the properties).
-
Use the ‘Wait for field change in current item’ activity to pause the workflow until one of the mandatory properties is not empty.
Option 3 is probably the most elegant, but it depends on your exact requirements.
For a tutorial on converting files to PDF Format from a SharePoint workflow check out this blog posting.