다음을 통해 공유


Automatically Detecting Manager for SharePoint Workflow Approvals

One of the most challenging task in SharePoint workflow seems like it should have been so easy OOB as it is a common use case. Most Approval workflows usually include the user’s manager at some stage. By default there is no intuitive way to dynamically determine a user’s manager for workflow purposes.

When you associate a workflow to a List of Library you have a choice of hard-coding the approvers via a named user or a AD or SharePoint group. it seems like there should be a direct option to refer to both the direct manager and the skip-level manager. Fortunately there is a way to achieve the same without writing any code by using SharePoint Design 2010.

The easiest approach is to Copy and Edit the existing Approval workflow. In SPD open the Workflows section and select the Approval workflow, which should enable the "Copy and Edit” button. Clicking this will copy and open the new copy in Edit mode:

image

When you receive the following dialog just accept and proceed:

image

Provide a name for your new workflow:

image

In the Approvers section is where you want to replace with the Item Creator’s Manager:

image

Under the Data Source you want to select User Profiles and then select Manager under fields as String.

image

Not exactly very intuitive but it can be done Smile