Search This Blog

Wednesday, January 7, 2015

Step by Step Guide in Developing your own Workflow in Sharepoint 2010

These  sample solution we will be developing a workflow to trigger from a list and based on the selection on one of the list column values it will trigger an email to be sent and update the items status.  Using this example I guess we will be tackling most of the important aspects of workflows such as steps, conditions and actions.
So lets start!
Lets start by creating a list and here is the structure.
Now for a bit of explanation here is what each fields do
Title - That will be the subject of the email you will be sending
User Email - The recipient email address
Message To user – The message in the email
Status - Whats the status of this item (choice between Started, Email Sent, Processing, Resolved)
Send Email - A flag whether email will be sent to recipient.
Once you created the list fire up Sharepoint Designer and start creating your workflow.  First go to List and Libraries
Choose your list and go to the Workflow section then create new
It will ask you to define a Workflow name and description
Now, the workflow designer shows
.
Now if you notice on the ribbon there is a Condition and Action Button, there are the key elements for designing the workflow, examine the items inside and these as it will list all the possibilities you can do.

Workflow Action Items

Workflow Condition Items

On on your Step 1, we choose “Email users” (this means when the workflow starts it will email a certain user of your choice)
Now define the Email Message
On the “To” section, choose users.  At this point we choose the email address stored on the list item.
We select that “User Email” column you created on your list
Now on the CC, you will add the one who added the list item.
For the title, we will get it from the “Title” column in your list
And for the body you choose the “Message to user” column in yousr list as well as the “Modified by” field
Congratulations! Your done with you first action, now lets add a condition on that action
Click on the top of the first action you had created
Add a common condition “If any value equals value” which means if a certain column in that current item falls in a value that you declare an action will be triggered
Now the condition appears on top of your first action
Now modify the values to what you want, since you want an action to happen when “Send Email” field has a value of “Yes” then define as such.
If you had noticed the First action you created was not on the IF block, so you need to move it up, to do that choose the drop down on the side and choose move action up
This will then place it inside the IF block
Now in this scenario lets say you also want to update the field “Status” to “Email Sent” when the email sent.  To do that, add another action by choosing the “Set Feild in Current Item”.  Make sure that you also click below your first action so that when you add a new action it will be placed there.
Now set the field and value properties
Now for your ELSE block, choose the “Else-If Branch” from the ribbon
Now do the same action above but this time set the “Status” to “Processing”
Now your all done!  Save and publish your workflow
Then, wait while its validating
But wait you need a trigger on when the workflow will start.  Do that by going to the Workflow objects, choose your workflow and configure it on the start options
Now all you have to do is test, create a list item to trigger conditions you built
Then wait for the results

No comments:

Post a Comment