dan.stoll

The Gentle art of delegation

Blog Post created by dan.stoll Employee on Apr 1, 2016

I'm re-surfacing an old blog post I did a few years back over on my personal blog site http://www.sharepointpub.com as it has come up in conversion a bit in the past few weeks.. I'll leave the SP2010 screenshots as the process is the same for 2013.

This is a pretty common scenario, and yes in most cases escalation isn’t setup.. By design, SharePoint will not allow anybody other than the task owner or an administrator the rights to approve a task. In Nintex Workflow by selecting the “Allow Delegation” a link will be placed on the task approval page. Allowing the task owner easy access to re-assign the task..

Now this is all fine, if it is the task owner, but what if they are away??. There are a couple of ways the admin can approve the tasks.

  1. Open the task from the task list and delegate to somebody else
  2. Open the workflow History and select the task that is shown and then approve as per above

Ok but what happens if this isn’t the case and you can’t get the admin to approve the task?. Or the team lead wants to be able to redirect tasks as needed, and isn’t a site admin. You can also build a workflow to sit on a list (I normally just put it on the list in question, but doesn’t have to be.) I like to have the workflow run on the list item in questions as so there is history against the list item that it had the task delegated. This workflow is a single action workflow utilizing the “Call Web Service” Action and uses the Nintex Workflow Web service

1 
http://{server}/{site}/_vti_bin/NintexWorkflow/workflow.asmx

And for those who want to see the soap envelope.

1 
<?xml version="1.0" encoding="utf-8"?> <soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:m="http://nintex.com"> <soap:Header> </soap:Header> <soap:Body> <m:DelegateTask> <m:spTaskId>{WorkflowVariable:Task ID}</m:spTaskId> <m:taskListName>Workflow Tasks</m:taskListName> <m:targetUsername>{WorkflowVariable:Assign To}</m:targetUsername> <m:comments> </m:comments> <m:sendNotification>1</m:sendNotification> </m:DelegateTask> </soap:Body> </soap:Envelope>

This method obviously needs the right credentials to have the ability to be able to delegate the task. So it either needs to be a site admin or farm admin account. For this example I’ve have built I only have Site Admin. I would recommend in a production environment, that you have an account that you use just for these types of activities and store it in the Farm Constants. (But that is another post) I have also used 2 Variables. ‘Task ID’ and ‘Assign To’. These have been made required and as you can see from the pic they are also start variables. This means when the workflow is started the splash screen will prompt you for this information and you will not be able to start the workflow without filling in this information.

Ok so publish this out (I also like to add this to the context menu, which can be found in the workflow settings) We need to get the ID of the task we require to change first. . I’m going to work on 30.. This being my test system, not sure why it hasn’t got an assigned to J But this workflow will change that.

Starting the workflow from the context menu

The Start page

All nice and filled in

After starting the workflow, I can now sit back and wait for the delegation to take effect (approx. 30secs) and because I specified in the web service call to send a notification an email will be sent to me telling me I have a new task

Depending on what account you use to action the web service, will depend on what shows in the notes. I’d also advise to put in some comments, just so everyone is aware of what is happening. One scenario might be though, that other will have access to the workflow and they shouldn’t be able to delegate the task. One quick method would be to put a passcode on the workflow, in the form of a Variable hardcoded into the workflow. First thing would the create a variable to store the value

Then we need a variable to ask the question the in the start form.

Now to add a little logic to the workflow to ask the question

Now when going to execute the workflow

Now if you also have Nintex Forms, you could make this smarted again and put this validation in the Form itself rather than having to worry about doing it in the workflow, but that is also a post to put in the back log Of course prevention is also better than a fix. If you are currently using Nintex Workflow or any other system for that matter that can make Web service calls, to get approvals for vacation time You can use the Nintex Workflow web service to delegate all new tasks between a specified time to someone specified whilst they are away.

<?xml version=”1.0″ encoding=”utf-8″?> 

<soap:Envelope xmlns:xsi=”
http://www.w3.org/2001/XMLSchema-instance”
xmlns:soap=”
http://schemas.xmlsoap.org/soap/envelope/”
xmlns:m=”
http://nintex.com”
>

<soap:Header> </soap:Header> <soap:Body>
<m:AddLongTermDelegationRule>
<m:fromTheBeginningOf>dateTime</m:fromTheBeginningOf>
<m:untilTheEndOf>dateTime</m:untilTheEndOf>
<m:delegateFrom>string</m:delegateFrom>
<m:delegateTo>string</m:delegateTo>
<m:currentSiteOnly>boolean</m:currentSiteOnly>
</m:AddLongTermDelegationRule> </soap:Body> </soap:Envelope>

 

This can also be set manually by any front end user also.

I hope this give you some food for thought.

Enjoy

Outcomes