Monday, August 12, 2013

Calculate field values in SharePoint Designer workflow

2 comments
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 !




2 comments:

Anonymous said...

nice............

Anonymous said...

super....