0
votes

I am trying to create a (2013) workflow in Sharepoint Designer that will set a field (sharepoint column) to the value: 1.

I am trying to have it run only when a new item is created in the root folder. So when a new folder is created at the top level of the document library. And specifically a folder.

I found that folders in Sharepoint don't have a content type - so I added the following If statement to the workflow to deal with that: If current item content type is empty... But now I would like to add a condition that says something like If the current item is created in the top level or root folder or...whatever

I see one of the fields you can select is: "level" - (see attached image). Is that maybe what I'm looking for? Does anyone else know a better solution?

Thanks a lot Sylvie

2
There is no attached image. Codes are welcomed in stackoverflow in question part. Please show us the code which is relevant to this issue and do not attach image.Aatif Akhter
I think I might have just answered my own question! I have to make it a Sharepoint 2010 workflow, not a 2013 So I can use the condition: "If Current item: Document Parent Identifier equals (the string for that root folder)" then run the workflow. I guess this field just doesn't exist in SP Designer 2013 workflows.Sylvie
Great ! May be you can write the solution in the answer part. So that, if anyone comes with the same problem he can get that benefit.Aatif Akhter

2 Answers

0
votes

I think I might have just answered my own question! I have to make it a Sharepoint 2010 workflow, not a 2013 So I can use the condition: "If Current item: Document Parent Identifier equals (the string for that root folder)" then run the workflow. I guess this field just doesn't exist in SP Designer 2013 workflows.

0
votes

I had exactly the same issue and I needed to use the SharePoint 2013 workflow. It is also possible by checking the Encoded Absolute URL of the created item. It has to be directly in the root of your list and the URL will contain no extensions, since it is a folder. Here is the code i had used:

Set Variable: ItemName_UrlStyle to [%Current Item:Name%]

Replace with %20 in [%Variable: ItemName_UrlStyle%] (Output to Variable: ItemName_UrlStyle )

If Current Item:Encoded Absolute URL equals https://abb.sharepoint.com/sites/SiteName/ListName/[%Variable:ItemName_UrlStyle%]

Maybe this will be helpful for somebody.