2

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 implement 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.

3
  • I have the same problem. The workflow creates a folder in a library, passes the ID back to a local variable, but when that variable is used to reference the folder, the ID number is incorrect by a value of -1. Also looking for a reason as to why this happens and how to compensate for it. Sunny
    – user16949
    Commented May 13, 2013 at 1:06
  • next time please use comments Commented May 13, 2013 at 6:02
  • Same problem, worse it is not always -1. If I create 5 folders in quick succession it becomes -5 ! So it is not simply adding 1 to the created variable returned. Interestingly, although created variable reports wrong ID when it is converted to Integer, it references the item correctly if it is used in an Update Item activity. Microsoft support couldn't explained the issue (the eventually said it was beyond their support boundary).
    – Charles
    Commented Jul 7, 2016 at 18:11

1 Answer 1

2

I don't know about the problem;

But a quick workaround I can think of is to pass the lookup value, folder title and other information in the FOLDER TITLE [separated by '|', let's say] from this workflow which you already have! and then create a designer workflow on Item adding of the Document Library, which split all the parameters from Title [splitting the Title on '|'] and set the Current Item fields accordingly...

Unfortunately there is no Split action in String Actions but since you have definite parameters you can use multiple SubString Action's to achieve the values...

But I strongly recommend to wait for other guys to answer this question, if not - then try this method :)

3
  • I've edited my original question to use your suggestion as a 'workaround'. The idea of having the second workflow on the document library instead of the original list hadn't crossed my mind. That is a workable solution should the folder ID reference issue remain unsolved.
    – tyshock
    Commented Nov 9, 2012 at 15:24
  • Don't know, but wait for few days - or start a bounty on the question to get attention of experts :) Commented Nov 9, 2012 at 16:27
  • I've marked this as the accepted answer. It feels like a kludge to have a second workflow wired up just to get the correct ID. However, that is the most straightforward solution. I just made sure to document the workflow clearly.
    – tyshock
    Commented May 13, 2013 at 15:41

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.