I have a SharePoint Designer workflow on a custom list that creates a corresponding folder in a document library. I then want to associate the firing list item to this newly created folder using the folder's ID. I have the workflow correctly creating the folder, but the reference that I get back as the 'Output to' variable for the 'Create Item' workflow action is incorrect. For example, 'Create Item' will get called, and the output variable will be set to an ID of, say, 68. However, when I go into the document library, the folder has been created, but actually has an ID of 70. I need the correct reference (in this case, 70) to the created folder so that I can set the lookup value for it in the original list item.
In my workflow, I have also tried to add another step to locate the folder by name instead of relying on the output variable. However, this step will not return a value during the initial folder creation. It seems like a transaction issue to me, i.e., the folder I've created can't be independently found in the list until the original creation operation (my workflow) completes. However, the same workflow step will find the folder by name and correctly populate the value if I run it a second time (after the folder has already been created in the first run).
Right now, my only workaround is to a separate workflow on the document library which will fire when the folder is created and correctly create the lookup reference on the original list item. However, for maintainability, I would like to keep this logic within a single workflow.