Question

I'm working on implementing a workflow which will start automatically on change/creation (which is working). The issue is that there are a few folders which need cross-department approval. Is there a way for a workflow to check which folder in the document library the file is in before assigning Approval tasks?

Ex) In the below structure, I would need File A to be approved by Ann, Bob, and Chris. Meanwhile, File B would need to be approved by Dan, Eric, and Fred.

Dept 1
|
|- Folder 1
|  |
|  |- File A
|
|- Folder 2
|  |
|  |- File B
Was it helpful?

Solution

You can check if current item relative URL is contain Folder name then assign task to related user.

You can refer below screenshot as example enter image description here

To check current document inside Folder(e.g. Folder4) or not. please follow below step that mention on screenshot.

  1. Get Current Document Server Relative URL. sites/tempsite/libraryname/Folder4/document.docx
  2. Then find index of Folder Name. Folder4
  3. Check if Index is greater then -1 then current document is inside folder

Note: - Makes sure that folder name and List name or Folder name and Site name are not same.

Licensed under: CC-BY-SA with attribution
Not affiliated with sharepoint.stackexchange
scroll top