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