This action can be used to get the list item id of the parent folder of an item. After you got the id of the folder you can use it with any other SPD action.
The action is included in my SharePoint Designer Actions 1.0 release on CodePlex. Source code is available.
Example scenario: Approver Folder Inheritance
You need a document based SharePoint Designer approval workflow with different approvers and permissions depending on the department of the document. But you don’t want to assign the approvers and permissions for each document individually! To inherit the permissions you would create for each department a folder and assign the permissions to it. Also you want to assign the approvers to the folder, because all documents within have the same approvers. But how you can get the approvers from the folder in the workflow? This is where the “Get Parent Folder” action comes in.
Step by Step
- Create a site column named “Approvers” type of “Person or Group”, allow multiple selection.
- Create a site content type named “Approval Folder”, as parent content type choose “Folder”
- Add the previous created site column to the just created content type
- Create a Document Library named “Approval Documents” and allow content types (Advanced Settings)
- Add the previous created site column to the just created content type
- Create a Document Library named “Approval Documents”
- In the “Advanced Settings” allow content types
- Add our “Approval Folder” content type to the document library
- Create a new “Approval Folder” named “Development” and assign the approvers (in this example myself and the administrator)
At this point we could start with the SharePoint Designer Workflow. To simplify the scenario I don’t set the approval status and simply create a to do item for the approvers.
- Create a new Workflow named “Approver Folder Inheritance”
- Add the “Get parent folder” action from the category “iLove SharePoint”
- For “this list” choose current item
- To store the “Result” create a new workflow variable type of “List Item ID”
- Now we have the list item id of the folder. To get approvers add a “Build Dynamic String” action.
- Click on “dynamic string” choose “Lookup Value” in the editor. In the lookup details choose as source “Approval Documents” and for field “Approvers”. To select the folder item choose ID as field. To choose the value click on “fx”, select “Workflow Data” and “folderId” as variable.
- Store the dynamic string in a new Workflow Variable named “approvers” and type of “Text”
- Next, add an “Assign a To-Do Item” action. Name the to-do item task “Approval Task”. In the people picker double click on “Workflow-Lookup”, choose “Workflow Data” and the “approvers” variable.
- Now we can save and test the workflow. Upload any document into the “Development” folder and start the workflow. The workflow creates tasks for the approvers we have assigned to the Development folder.
- That’s it.
By the way: I don’t like SharePoint Designer Workflows , I prefer Nintex Workflow!
1 comment:
The Actions working also well with SharePoint Designer 2010 !
Thank you Christian !
Post a Comment