Monday, August 19, 2013

Stages for Workflows in SharePoint Designer 2013

This blog post will show how we can use stage in workflow in sharepoint designer 2013. Stage is a group of  action/activities, it is new feature of sharepoint designer 2013. There is at least 1 stage in workflow and there is only one way in and one way out of the stage.

Here for demonstration, I have 3 lists, made from Announcement List Template. 

1. Announcement
2. CustomerAnnouncement
3. EmployeeAnnouncement

Announcement list will have 1 additional column :

Name : "PostTo"
Type : Choice
Values : Employee and Customer.

Step 1: Go to sharepoint Designer 2013, select list workflow from ribbon and select Announcement list.

Step 2:  Add 2 new Stages to the workflow and name it as CustomerAnnouncement and EmployeeAnnouncement

Step 3 : Rename Stage 1 to MoveToTargetAnnouncementList

Raw structure should look like this.

Step 4: Add Condition If any values equals to value to Transition to stage section inside MoveToTargetAnnouncementList Stage.

 Compare value of PostTo field to customer for moving control to CustomerAnnouncement and employee for moving to EmployeeAnnouncement Stage

Step 5: In EmployeeAnnouncement Stage,Add Create a new list item action. Select List to EmployeeAnnouncent with 2 properties such as  1. Title : current item title 2. Body: current item body

End the workflow in transition.

Step 6: Do same steps for Customer Announcement

Step 7: Save and publish workflow

Step 8 : To test, Go to announcement list, add title, body and posto:Employee. Start workflow and you can see an item is created in employeeAnnouncement list. Similarly an item will be added to customerAnnouncment list  if postTo value is Customer.

Enjoy !


Friday, August 16, 2013

Screencast : Simple Sharepoint 2013 visual studio workflow

Leave a Comment


Monday, August 12, 2013

Calculate field values in SharePoint Designer workflow

As we know, to fill calculated values in list item, we can use calculated fields, but same we can also be done using sharepoint designer workflow in 2013.

Following is the scenario

Scenario:  Calculate Total Amount based on the no of tickets and price per ticket.

Create TicketInvoice List and add following list columns

1. NoOfTickets: Number
2. PricePerTicket: Number
3. TotalAmount: Number

Go to sharepoint designer 2013 and create list workflow selecting TicketInvoice List.

On text based designer window, click "Stage 1" and rename to "CalculateTotalAmount". Here we just updating stage title.

Add Do Calculation action from Ribbon --> Actions --> Core Actions

Then specify Local Variables to hold calculated value.

Click "Local Variables" from variable tab in ribbon and add new item. Let say  TotalAmount type Number.

Hit OK to save parameter.

Specify 2 calculated fields with multiply operator type in Do calculation  template as mention in pic below.

Then add Step after Do Calculation action, to update listitem with calculated value.

Select Update list Item action from Actions. Click current Item to add field and value to be updated

Set field TotalAmount with Variable: TotalAmount.

Set transition stage to End of Workflow. Workflow should look like this.

Set workflow settings as Start workflow automatically when a item is created.

Save and publish workflow. Go to list and add item to TicketInvoice list. And you will able to see value in TotalAmount

Enjoy !


Sunday, August 11, 2013

Custom item menu action in document Library

1 comment
Many times we need additional functionality to List and Library. To fill this gap we add webpart to the listview page, add ribbon item or add custom action to the item menu. Here i will show you how to add custom action to document library item menu.

Scenario : Add custom action name  "Custom Action" in Item menu in document library.

We can add custom action using Empty Element. Add Empty Element to the existing project.

Click  Element.xml. Add following text to it.

<Elements xmlns="">
  <CustomAction Id="MyCustomAction"
    Title="Custom Action">
    <UrlAction Url="javascript:alert('Hello world')"></UrlAction>/>

Id: Custom Action id.
RegistrationType: Where you want to attach per item. Possible values are None, List, ContentType, ProgId, FileType

RegistrationId: Identifier for the list.  In our case it is document library so "101"
Location:  Location for the custom action
Sequence: Order for the priority for action
Title: Title for the action
UrlAction: Specify action for page.

Deploy solution and go to document library to verify solution.

It should look like this

More more information on custom action check this reference article


Thursday, August 8, 2013

SharePoint tip #5 KQL ignores time portion in query text

Leave a Comment
In sharepoint 2013 search kql ignores time portion from the query. So to filter search results based on time portion use FQL range operator in refinementfilters.

Check out Mikael Svenson(MVP) blog post on same.

Wednesday, August 7, 2013

Simple designer workflow for sharepoint 2013

Leave a Comment
Here i will show you how to get started with designer workflow in sharepoint 2013

SharePoint 2013 workflow uses new workflow manager service which is build on top to windows workflow foundation. Follow steps from msdn  article ( to install workflow manager 1.0.

Scenario :  If  person uses apple handset then add name of the person to Apple List

Before we start creating workflow, we will need 2 lists.

List 1: UserList
Type: CustomList
Fields:  1. UserName : Single Line of Text
                2. MobileHandSet: Single Line of Text

List 2: AppleHandsetUserList
Type : CustomList
Fields:  1. UserName: Single Line of Text

Once list is created then go to SharePoint Designer and connect to the Site.

Once site is open click Workflow from left pane. And then click List Workflow from ribbon

 On List Workflow menu, click "UserList" . This will open Create List Workflow dialog box

Name: "Apple handset user tracker"
Description : " Tracking users who use apple handset"
Platform Type:  SharePoint 2013 Workflow 
Hit OK.

This will bring you to text-based designer

Specify condition in Stage 1. Under Common Condition in Condition in ribbon, select "if any values equals value" 

Click first value, to select field from dialog. Select MobileHandSet from field. Then click right side value, this will open blank dialog. Enter Apple inside it and hit save.

Now specify Action if condition is met.

Click Actions --> List Actions --> CreateListIem

Click "this list" from action text. Select List: AppleHandsetUserList and specify field and value

Now we are almost ready. Just one final step. i.e Transition to stage 
Select Go to Stage. End of workflow.  Your workflow should look like below snapshot.

Select start up options for the workflow from list Workflow --> Workflow settings

Select Start workflow automatically when item is created.

Click "check for the errors from workflow tab in ribbon. If there are no error then hit save and the publish. 

Go to UserList to test workflow.

Enjoy !


Tuesday, August 6, 2013

SharePoint Tip # 4 : QueryText limits in SharePoint Search 2013

Leave a Comment
The length limit of a KQL query varies depending on how you create it. If you create the KQL query by using the default SharePoint search front end, the length limit is 2,048 characters. However, KQL queries you create programmatically by using the Query object model have a default length limit of 4,096 characters. You can increase this limit up to 20,480 characters by using the MaxKeywordQueryTextLength property or theDiscoveryMaxKeywordQueryTextLength property (for eDiscovery).

Reference :

Monday, August 5, 2013

SharePoint Tip #3

Leave a Comment
It is not possible to compare one managed property with another managed property, such as <property name> <property operator> <property name> in Search Query. If both fields are part of list then create calculated Field managed property and query against calculated field managed property.

Thursday, August 1, 2013

SharePoint Tip #2

Leave a Comment
The Default KeywordQuery.RowLimit for Search Results is 50, which can be set max till 500. To extend till 10,000, set MaxRowLimit in SearchService Applicaion. To get more than 10,000 search results, then implement paging  by using StartRow and RowLimit properties.

Reference :