Sunday, 9 October 2016

Understanding Task Actions in SharePoint Designer 2013

A task in SharePoint Server 2013 is used to assign work to a person or group and then track the progress of that work over time. There are two workflow actions in SharePoint Designer 2013 designed for working with tasks.
These actions are:
Assign a task is used to create a SharePoint 2013 task and assign it to a single participant.
Start a task process is used to assign a task to multiple participants.
The Task Actions are accessed in the Action drop-down menu of the SharePoint Designer 2013 ribbon, as shown in the figure.
Figure: Task Actions in SharePoint Designer 2013

Task Actions are available from the Action drop-down menu of the SharePoint Designer 2013 Preview ribbon
Using Task Actions in SharePoint 2013
A business process often consists of tasks that must be performed by people. A workflow orchestrates the steps of a process. A workflow uses Task Actions to assign tasks to people. For example, when a new employee is hired a number of tasks need to be performed. One such task might be a new employee orientation. The task might need to be performed by a member of the Human Resources department.
The Assign a task and Start a task process actions are located on the Actions drop-down menu in the SharePoint Designer 2013 ribbon. You can add the actions to your workflow and then customize them for your particular circumstance. The Assign a task action is used to assign a task to a single participant. The Start a task process action is used to assign a task to multiple participants.
Assign a task
The Assign a task action is shown in the figure.
Figure: The Assign a task action in SharePoint Designer 2013
"Assign a task" action in SharePoint Designer 2013.
The Assign a task action takes three inputs: the user to assign a task, the outcome variable, and the task id variable.
this user: Opens the Assign a Task dialog as shown in the figure. Use the dialog to set the participant, task title, description, due date, task options, email options, and outcome options.
Variable: Outcome: Assigns the variable that will hold the outcome of the task.
Variable: TaskID: Assigns the variable that will hold the id of the task.
Figure: The Assign a Task dialog box

Use the "Assign a task" dialog box to set the participant, task title, description, due date, task options, email options, and outcome options.
Start a task process
The Start a task process action is shown in the figure.
Figure: The "Start a task process" action.
The "Start a task process" action takes two inputs: "users" and an "outcome" variable
The Start a task process action takes two inputs: the users that will participate in the task and the outcome variable.
these users: Opens the Start a Task Process dialog box as shown in the figure. Use the dialog box to set the participants, task title, description, due date, task options, email options, and outcome options.
Variable: Outcome: Assigns the variable that holds the outcome of the task process.
Figure: The Start a Task Process dialog box
Use the "Start a Task Process" dialog box to set the participants, task title, description, due date, task options, email options, and outcome options.

Saturday, 8 October 2016

SharePoint 2013 Workflow: ‘Start a Task Process’ vs. ‘Assign a Task’ and Retrieving Comments from a Task List Item

While working on a SharePoint Designer 2013 (SPD2013) workflow for a document library, I ran into a particular scenario where I needed to get the value from a workflow task list item and include this value in the next assigned task. The specific scenario is noted below:

An approval task gets assigned to ‘Approver A’
If ‘Approver A’ approves, the workflow continues
If ‘Approver A’ rejects, the approver enters a reason for rejection in a ‘Comments’ column.
On rejection, ‘User A’ gets a task to review and complete the task once ready to resubmit for approval.
The requirement: ‘User A’ needs to be able to quickly see why their item (i.e. document) was rejected – ‘User A’ should be able to see the rejection reason as part of their ‘review’ task description.

ActionMultiple AssigneesSingle AssigneeReturns Values
Start a Task ProcessYESYESTask Outcome
Assign a TaskNOYESTask Outcome
Task ID
In SharePoint Designer you can directly access the workflow task list related columns under ‘Association: Task List’ if you have the Task ID of the particular task. Having this option was both fortunate and unfortunate at the time. Fortunate, since it allowed me to quickly accomplish my requirement with an OOTB solution. Unfortunate, because I did not have the Task ID. If you have created SPD2013 workflows, you may have noticed that the ‘Assign a Task’ action returns the Task ID. You also may or may have noticed that in 2013, there is also an action called ‘Start a Task Process.’
ComparisonTaskActions
Let’s take a look at the main differences between these 2 types of actions:
Note: Only differences relevant to the context of this post have been listed.
StartATaskProcess
AssignATask
Note that both of these actions are very similar, and in essence, do the same thing – assign an approval task. The way I see it, if you need to assign the same task to multiple people or to be able to assign a task to each individual person within a group (SharePoint or AD), consider using the ‘Start a Task Process.’ If not, the latter might come in handier if you need the Task ID for anything.
In my case, there was a requirement where I needed to assign the task to multiple people and take the first response as the outcome for the task. In this scenario, the ‘Start a Task Process’ was the right way to go. It was also the cause of the issue, this action did not return the key piece of information I needed, a Task ID. At the time, I turned to finding an alternative solution. I considered more complex routes such as using the ‘Call HTTP Web Service’ to get all tasks related to the current instance of the workflow but such options came with a variety of unnecessary complexities.
As I was concluding that a more complex solution may be unavoidable, between conversations with the client, it was noted that the business process could be tweaked. Turns out that while the particular task could have multiple approvers, 99% of the times it only had 1. Considering this, the client was ok with making it a part of the business process to only allow 1 approver. Luckily for me, tweaking the business process allowed me to use the ‘Assign a Task’ action and put me back in the OOTB business: Use the Task ID to locate the task of interest, get the value needed and save it in a variable. Add the variable to the next task’s description and there you go, requirement met.

AssociationTaskList

Tuesday, 4 October 2016

Server-side activities have been updated. You need to restart SharePoint Designer

The usual advice is:

Level 1: Clear the cache folders
See for example How to Clear Your SharePoint Designer 2010/2013 Cache. If you've just deployed some custom workflow activities to your site, this will probably solve your problem (and you should clear the cache folders every time you deploy custom activities). If the error occurs spontaneously, this approach often won't help.

Level 2: Reinstall SharePoint Designer
This might work if you've got a preview version of SharePoint Designer installed. If not, it's unlikely to help. It didn't work for me, and it didn't work for countless others on the forums.

Level 3: Install SharePoint Designer on another machine
This one kind of annoys me... it usually works, but it's hardly a practical solution to the problem.

In my case, having tried approach 1 and 2 and having established that the problem was client-specific (a colleague was able to connect to the same sites and create workflows just fine), I did some digging around to see what else could be causing the problem.

For me, I copied these files across to my own cache folder. The key file turned out to be the Microsoft.SharePoint.WorkflowServices.Activities.Proxy.dll assembly. Have to download this and copy to WebsiteCache\<Sitecollectionname>\15.0.0.4455. After that, my designer worked properly and I'm able to create a workflow in SharePoint designer without error. Thanks for reading.

Sunday, 7 December 2014

Understanding Window.Open()

Most of you would be familiar with Window.Open() but i will explain in detail :

window.open(URL, name , specs , replace )

In new version we can use it as

window.open(MIMEtype, ContainerItems)

window.open (MIMEtype   ,  replace )                                                

                                                |________  It takes the element from window opener                    
                                 |___________   Default MIME type is "text/html"


We have to just specify our required MIMEtype and it does the job for us! So for converting into MS Excel, we will specify data:application/vnd.ms-excel as MIME type. Replace is the item taken from opener-window whose html we are going to send into Excel sheet. This container element shouldn't have special characters. If it contains then we have to encode those characters using JavaScript's encodeURIComponent().

Client side Export table data to Excel

We can use method Window.Open() which will do our job easy. with this method we can easy export our table data to excel from client side.

Bellow code will help :

$("[id$=buttonControlID]").click(function(e) {
    window.open('data:application/vnd.ms-excel,' + encodeURIComponent( $('div[id$=divTableData]').html()));
    e.preventDefault();
});​


Here above method will do export our data to excel.

Understanding of "Window.Open()" i will post in very next post once i understood.