SlideShare a Scribd company logo
Salary Advance Workflow
Ifeanyi I Nwodo
(B.Eng, MCSN,OCA,OCP, MCPD,MCTS,OCJP)
07033798594, 08187693785 .
joshuasearch@live.com
http://www.facecompete.com
http://alvana.facecompete.com
http://sharepointbi.facecompete.com
This Article is a continuation of an online video that demonstrated how to create Custom list you can
view the video here or download it here
In this Article I will show you how to create a SharePoint Workflow based on a List. I will be using
the Advance Salary list I created in the video and will also be utilising the web application and its Site
collection URL I created in the tutorial. So let’s get started.
Scenario:
—Create a Salary Advance Work Flow by which employees can request Salary Advancement, request
mailed to accounts personnel, reply of either approved or rejected corresponded to employee—
 Create a New SharePoint Project in Visual studio. You can Name SalaryAdvance
 Define the url to the Web Application in SharePoint server (Contains the List we will be
using).
 Slect Define as Farm Solution (Workflows are farm based solution).
 Click finish.
Now our new SharePoint projected is created. Next thing to do is to add aworkflow item to it. For
this article we will be using A sequential Workflow, since our scenario and associated logic is simple.
 Right click on project,
 Point to Add and click on New Item.
See below.
 Click on Sequential Workflow
 Name it. Example SalaryAdvance
 Click Add
 Specify List Workflow for the workflow template
 Click Next
 Select the List to associate with the Workflow
Salary advanceworkflow
 Click Finish
Now your window should be similar to the following
Note : You can rename the feature 1 to AdvanceSalary as shown in the illustration above
Our Sequential workflow kicks off with on workflowActivated1 item, usually the default. However
we will need to do more to achieve a truly Salary Advance workflow.
First we are going to define a while loop that will hold our workflow recurring activities, when the
workflow is activated
Rename it to WhileNotCompleted because it is meant to loop until the workflow tasks are
completed.
The while only allows one activity, however I may want to execute more than one activity. So I will
use a sequence activity which is an activity item encapsulating single or multiple activity.
Now I can enter activities that will allow me to check for a change in state within the workflow and
perform a task I will add onworkflowitemchanged item and ifelse activity see below:
As you can see there are warning signs on the added activities, reason being that I am yet to set
condition and token.
 Click on the while activity
 On the properties window click on the Condition option and choose Code Condition.
Expand the Code Condition option from the properties window. Click on Condition option
and type a method name for the condition example OnWhile and press enter.
Type in the displayed method to enable the while
private void OnWhile(object sender, ConditionalEventArgs e)
{
e.Result = true;
}
Now to the onWorkflowItemChanged. For this item you will need to tag it, in other words
you need to specify its correlation token. Do this
 Click on onWorkflowItemChanged
 Click on the correlationToken option on the properties window and type
workflowToken
Now let’s work on the if here I am going to rename the if branches to correspond with the advanced
salary status which are:
 Approved
 Rejected
 Initiated
In all cases the activity will be logged and the appropriate persons informed the status of workflow.
Now rename the if branches as
 ifApproved
 ifRejected
Also create conditions for them with similar names not the same ones.
The first ifBranch
The second ifelseBranch
Now let’s work on the individual ifbranches by parsing the activities that will be executed when the
various if condition s are met, this activities include :
 Login the activity,
 Sending a mail to the initiator and
 Completing/terminating the workflow
Before we proceed we will need to create a field that will hold a status value when any change occur
in the workflow. Do the following:
 Click on the onWorkflowItemChanged
 Click on the bind properties of the AfterPropertis option on the properties window
 On the resulting dialog box click bind to a new member(see below)
 Click create Field
 Click ok
 Repeat the same steps to create a field for the BeforeProperties.
With that achieved, it’s time to populate the if conditions methods and determine their result
based on the value of the Status. Open the IfStatusApproved method you created earlier for the
ifApproved ifelse branch and enter the following:
private void IfStatusApproved(object sender, ConditionalEventArgs e)
{
string status = onWorkflowItemChanged1_AfterProperties1["Status"].ToString();
if (status == "Approved")
{
e.Result = true;
}
else
{
e.Result = false;
}
}
 Repeat a Similar thing for the ifRejected Condition and apply the following:
private void IfStatusRejected(object sender, ConditionalEventArgs e)
{
string status = onWorkflowItemChanged1_AfterProperties1["Status"].ToString();
if (status == "Rejected")
{
e.Result = true;
}
else
{
e.Result = false;
}
}
Both methods sought to test the values in the status and based on that execute the conditions.
Let’s apply the activities that will execute tasks based on the conditions:
 Login the activity,
 Sending a mail and
 Completing/terminating the workflow
Add the following activities from the tool box to both branches :
 logToHistoryListActivity
 sendmail
 TerminateActivity
Rename them appropriately
 Let’s add an ifelse branch that will be responsible for sending mail to the accounts
department when the workflow is initiated by an employee.
o Add an ifelse branch, rename it to ifInitiated, add a log activity history and send
email to it. Also add its correlation token and condition, you can use the method
name ifStatusInitiated, and as done above specify the content below for the
method.
private void ifStatusInitiated(object sender, ConditionalEventArgs e)
{
string status = onWorkflowItemChanged1_AfterProperties1["Status"].ToString();
if (status == "Initiated")
{
e.Result = true;
}
else
{
e.Result = false;
}
}
Your Workflow Design should look like:
Now let’s work on the content of the ifelse branches. The Logs are logged automatically they need
no codes/method, the activity terminate also have predefined task hence they need no methods,
but the send mail do, so let’s complete that.
 Define CorrelationToken for the send mail activities as was done earlier
foronworkflowitemchanged.
 Generate Handlers for the sendApprovalEmail
o To achieve this:
 Right Click on sendApprovalEmail
 Click Generate Handlers
 Type the following into the method:
private void sendApprovalEmail_MethodInvoking(object sender, EventArgs e)
{
//Create an Item object based on our List
SPListItem item = onWorkflowActivated1.WorkflowProperties.Item;
//get the Employee Field Colunm from our List
SPFieldUser assignedto = (SPFieldUser)item.Fields["Employee"];
//get the field value content of Accountant Clerk
SPFieldUserValue user =
(SPFieldUserValue)assignedto.GetFieldValue(item["Employee"].ToString());
//get the Requested Date Field Colunm from our List
SPFieldDateTime requestedDate = (SPFieldDateTime)item.Fields["Requested Date"];
//get the field value content of Requested Date
string rdt = requestedDate.GetFieldValue(item["Requested Date"].ToString()).ToString();
//get the Amount Field Colunm from our List
SPFieldCurrency amount = (SPFieldCurrency)item.Fields["Amount"];
//get the field value content of Amount
string amt = amount.GetFieldValue(item.Fields["Amount"].ToString()).ToString();
//get employee email, assign mail subject, and body
string assigneeEmail = user.User.Email;
sendApprovalEmail.To = assigneeEmail;
sendApprovalEmail.Subject = "Advance Salary Request Approved";
sendApprovalEmail.Body = "Salary Advance Request with ID " +
onWorkflowActivated1.WorkflowProperties.Item.ID.ToString() + ".n Requested Date :" + rdt +
".nn Amount Requested :"+amt+".nn Has been Approved.";
}
 Generate Handlers for the sendRejectedEmail
o To achieve this:
 Right Click on sendRejectedEmail
 Click Generate Handlers
 Type the following into the method:
private void sendRejectedEmail_MethodInvoking(object sender, EventArgs e)
{
//Create an Item object based on our List
SPListItem item = onWorkflowActivated1.WorkflowProperties.Item;
//get the Employee Field Colunm from our List
SPFieldUser assignedto = (SPFieldUser)item.Fields["Employee"];
//get the field value content of Accountant Clerk
SPFieldUserValue user =
(SPFieldUserValue)assignedto.GetFieldValue(item["Employee"].ToString());
//get the Requested Date Field Colunm from our List
SPFieldDateTime requestedDate = (SPFieldDateTime)item.Fields["Requested Date"];
//get the field value content of Requested Date
string rdt = requestedDate.GetFieldValue(item["Requested Date"].ToString()).ToString();
//get the Amount Field Colunm from our List
SPFieldCurrency amount = (SPFieldCurrency)item.Fields["Amount"];
//get the field value content of Amount
string amt = amount.GetFieldValue(item.Fields["Amount"].ToString()).ToString();
//get employee email, assign mail subject, and body
string assigneeEmail = user.User.Email;
sendApprovalEmail.To = assigneeEmail;
sendApprovalEmail.Subject = "Advance Salary Request Rejected";
sendApprovalEmail.Body = "Salary Advance Request with ID " +
onWorkflowActivated1.WorkflowProperties.Item.ID.ToString() + ".n Requested Date :" + rdt +
".nn Amount Requested :" + amt + ".nn Has been Rejected.";
}
 Also generate Handlers for the sendInitiatedEmail
o To achieve this:
 Right Click on sendInitiatedEmail
 Click Generate Handlers
 Type the following into the method:
private void sendInitiatedEmail_MethodInvoking(object sender, EventArgs e)
{
//Create an Item object based on our List
SPListItem item = onWorkflowActivated1.WorkflowProperties.Item;
//get the user Field Colunm from our List
SPFieldUser assignedto = (SPFieldUser)item.Fields["Accountant Clerk"];
//get the field content of Accountant Clerk
SPFieldUserValue user = (SPFieldUserValue)assignedto.GetFieldValue(item["Accountant
Clerk"].ToString());
string assigneeEmail = user.User.Email;
sendApprovalEmail.To = assigneeEmail;
sendApprovalEmail.Subject = " Salary Advance Request ";
sendApprovalEmail.Body = "Advance Salary Request <br/><br/>Request ID:" +
onWorkflowActivated1.WorkflowProperties.Item.ID;
}
That’s all. We can now build and deploy.
Simply right click on the project and choose build, repeat the same steps but choose deploy to
deploy it to the SharePoint server .see below.
From the Site collection features of our SharePoint server you can see our new feature running
We can have our workflow started by creating item on the Advance Salary List.
Until we meet a gain from me to you its Nkoma……..
Download complete sandboxed project here.

More Related Content

PPT
IMPACT/myGrid Hackathon - Introduction to Taverna
DOC
Cis407 a ilab 5 web application development devry university
PDF
Set up email authentication using react native + firebase auth + react naviga...
PDF
Build Restful Service using ADFBC
DOC
Cis407 a ilab 1 web application development devry university
DOC
Demystifying Keyword Driven Using Watir
DOCX
Create rest webservice for oracle public api using java class via jdeveloper
DOC
Expense personalization
IMPACT/myGrid Hackathon - Introduction to Taverna
Cis407 a ilab 5 web application development devry university
Set up email authentication using react native + firebase auth + react naviga...
Build Restful Service using ADFBC
Cis407 a ilab 1 web application development devry university
Demystifying Keyword Driven Using Watir
Create rest webservice for oracle public api using java class via jdeveloper
Expense personalization

Viewers also liked (17)

PPTX
Polenza (2)
PPTX
Introduction to social media cs112 & cs105 project
PDF
BI Tutorial (Copying Data from Oracle to Microsoft SQLServer)
PPTX
Keep your customers glued to you with Your Branded Email
PPTX
Introduction to social media cs112 & cs105
PDF
SharePoint Re-branding The VisualStudio Way Part One SandBox Solution
DOCX
Sk operator
PPTX
1310144 color image final
PDF
Excellent prospects. Welcome to the University of Liechtenstein.
PDF
Apostila física pibid
PDF
makalah perintah dasar windows (command prompt)
PPT
Vasariški batai | Basutės, Šlepetės, Sandalai
PDF
أهمية الحقائب22
PPTX
تعليم الوضوء
PPTX
تعليم الوضوء
PPTX
1أهمية الحقائب
DOCX
Makalah Komponen dalam Motherboard
Polenza (2)
Introduction to social media cs112 & cs105 project
BI Tutorial (Copying Data from Oracle to Microsoft SQLServer)
Keep your customers glued to you with Your Branded Email
Introduction to social media cs112 & cs105
SharePoint Re-branding The VisualStudio Way Part One SandBox Solution
Sk operator
1310144 color image final
Excellent prospects. Welcome to the University of Liechtenstein.
Apostila física pibid
makalah perintah dasar windows (command prompt)
Vasariški batai | Basutės, Šlepetės, Sandalai
أهمية الحقائب22
تعليم الوضوء
تعليم الوضوء
1أهمية الحقائب
Makalah Komponen dalam Motherboard
Ad

Similar to Salary advanceworkflow (20)

PPTX
Workflow functional concept on openerp7
PPTX
CASPUG - Developing Reusable Workflow Features
PPT
SharePoint workflow deep-dive
PPTX
Automate business processes using SharePoint Designer Workflows
DOCX
Taskless workflow presentation outline spsbend 2011
PPTX
Developing Reusable Workflow Features (SPSVB)
PPTX
Spstc2011 Developing Reusable Workflow Features
PDF
DF2UFL 2012: Workflows: Making the MOST of Salesforce.com Native Functionality
PPTX
SharePoint Saturday Workflow in Action
PPTX
Windows workflow foundation in .Net Framework
PPTX
SharePoint Workflow Best Practices
PPT
PPT
C:\fakepath\sps ppt portfolio lalitha1
PPTX
Process Improvement through SharePoint Workflows. Connect the Click Points. G...
PPTX
Developing Reusable Workflow Features (SPS Richmond)
DOC
Workflow demo
PPTX
Writing futuristic workflows in office 365 SharePoint 2013 2016 on premise
PPTX
Peter Ward: The True Power of SharePoint Designer Workflows
PDF
How Can Workflows in Zoho CRM Be Effectively Automated
PDF
BPM-1 Introduction to Advanced Workflows
Workflow functional concept on openerp7
CASPUG - Developing Reusable Workflow Features
SharePoint workflow deep-dive
Automate business processes using SharePoint Designer Workflows
Taskless workflow presentation outline spsbend 2011
Developing Reusable Workflow Features (SPSVB)
Spstc2011 Developing Reusable Workflow Features
DF2UFL 2012: Workflows: Making the MOST of Salesforce.com Native Functionality
SharePoint Saturday Workflow in Action
Windows workflow foundation in .Net Framework
SharePoint Workflow Best Practices
C:\fakepath\sps ppt portfolio lalitha1
Process Improvement through SharePoint Workflows. Connect the Click Points. G...
Developing Reusable Workflow Features (SPS Richmond)
Workflow demo
Writing futuristic workflows in office 365 SharePoint 2013 2016 on premise
Peter Ward: The True Power of SharePoint Designer Workflows
How Can Workflows in Zoho CRM Be Effectively Automated
BPM-1 Introduction to Advanced Workflows
Ad

Recently uploaded (20)

PDF
Transform Your ITIL® 4 & ITSM Strategy with AI in 2025.pdf
PPTX
KOM of Painting work and Equipment Insulation REV00 update 25-dec.pptx
PDF
Approach and Philosophy of On baking technology
PDF
MIND Revenue Release Quarter 2 2025 Press Release
PDF
Accuracy of neural networks in brain wave diagnosis of schizophrenia
PDF
Getting Started with Data Integration: FME Form 101
PPTX
SOPHOS-XG Firewall Administrator PPT.pptx
PDF
Unlocking AI with Model Context Protocol (MCP)
PDF
Heart disease approach using modified random forest and particle swarm optimi...
PDF
Microsoft Solutions Partner Drive Digital Transformation with D365.pdf
PDF
project resource management chapter-09.pdf
PDF
Zenith AI: Advanced Artificial Intelligence
PPTX
OMC Textile Division Presentation 2021.pptx
PDF
A comparative analysis of optical character recognition models for extracting...
PDF
1 - Historical Antecedents, Social Consideration.pdf
PPTX
Chapter 5: Probability Theory and Statistics
PPTX
TLE Review Electricity (Electricity).pptx
PDF
Hybrid model detection and classification of lung cancer
PDF
A comparative study of natural language inference in Swahili using monolingua...
PDF
Enhancing emotion recognition model for a student engagement use case through...
Transform Your ITIL® 4 & ITSM Strategy with AI in 2025.pdf
KOM of Painting work and Equipment Insulation REV00 update 25-dec.pptx
Approach and Philosophy of On baking technology
MIND Revenue Release Quarter 2 2025 Press Release
Accuracy of neural networks in brain wave diagnosis of schizophrenia
Getting Started with Data Integration: FME Form 101
SOPHOS-XG Firewall Administrator PPT.pptx
Unlocking AI with Model Context Protocol (MCP)
Heart disease approach using modified random forest and particle swarm optimi...
Microsoft Solutions Partner Drive Digital Transformation with D365.pdf
project resource management chapter-09.pdf
Zenith AI: Advanced Artificial Intelligence
OMC Textile Division Presentation 2021.pptx
A comparative analysis of optical character recognition models for extracting...
1 - Historical Antecedents, Social Consideration.pdf
Chapter 5: Probability Theory and Statistics
TLE Review Electricity (Electricity).pptx
Hybrid model detection and classification of lung cancer
A comparative study of natural language inference in Swahili using monolingua...
Enhancing emotion recognition model for a student engagement use case through...

Salary advanceworkflow

  • 1. Salary Advance Workflow Ifeanyi I Nwodo (B.Eng, MCSN,OCA,OCP, MCPD,MCTS,OCJP) 07033798594, 08187693785 . joshuasearch@live.com http://www.facecompete.com http://alvana.facecompete.com http://sharepointbi.facecompete.com This Article is a continuation of an online video that demonstrated how to create Custom list you can view the video here or download it here In this Article I will show you how to create a SharePoint Workflow based on a List. I will be using the Advance Salary list I created in the video and will also be utilising the web application and its Site collection URL I created in the tutorial. So let’s get started. Scenario: —Create a Salary Advance Work Flow by which employees can request Salary Advancement, request mailed to accounts personnel, reply of either approved or rejected corresponded to employee—  Create a New SharePoint Project in Visual studio. You can Name SalaryAdvance  Define the url to the Web Application in SharePoint server (Contains the List we will be using).  Slect Define as Farm Solution (Workflows are farm based solution).
  • 2.  Click finish. Now our new SharePoint projected is created. Next thing to do is to add aworkflow item to it. For this article we will be using A sequential Workflow, since our scenario and associated logic is simple.  Right click on project,  Point to Add and click on New Item. See below.  Click on Sequential Workflow
  • 3.  Name it. Example SalaryAdvance  Click Add  Specify List Workflow for the workflow template  Click Next  Select the List to associate with the Workflow
  • 5.  Click Finish Now your window should be similar to the following Note : You can rename the feature 1 to AdvanceSalary as shown in the illustration above Our Sequential workflow kicks off with on workflowActivated1 item, usually the default. However we will need to do more to achieve a truly Salary Advance workflow. First we are going to define a while loop that will hold our workflow recurring activities, when the workflow is activated
  • 6. Rename it to WhileNotCompleted because it is meant to loop until the workflow tasks are completed. The while only allows one activity, however I may want to execute more than one activity. So I will use a sequence activity which is an activity item encapsulating single or multiple activity.
  • 7. Now I can enter activities that will allow me to check for a change in state within the workflow and perform a task I will add onworkflowitemchanged item and ifelse activity see below: As you can see there are warning signs on the added activities, reason being that I am yet to set condition and token.  Click on the while activity  On the properties window click on the Condition option and choose Code Condition.
  • 8. Expand the Code Condition option from the properties window. Click on Condition option and type a method name for the condition example OnWhile and press enter. Type in the displayed method to enable the while
  • 9. private void OnWhile(object sender, ConditionalEventArgs e) { e.Result = true; } Now to the onWorkflowItemChanged. For this item you will need to tag it, in other words you need to specify its correlation token. Do this  Click on onWorkflowItemChanged  Click on the correlationToken option on the properties window and type workflowToken Now let’s work on the if here I am going to rename the if branches to correspond with the advanced salary status which are:  Approved  Rejected  Initiated In all cases the activity will be logged and the appropriate persons informed the status of workflow. Now rename the if branches as  ifApproved  ifRejected Also create conditions for them with similar names not the same ones.
  • 10. The first ifBranch The second ifelseBranch Now let’s work on the individual ifbranches by parsing the activities that will be executed when the various if condition s are met, this activities include :  Login the activity,  Sending a mail to the initiator and  Completing/terminating the workflow Before we proceed we will need to create a field that will hold a status value when any change occur in the workflow. Do the following:  Click on the onWorkflowItemChanged  Click on the bind properties of the AfterPropertis option on the properties window
  • 11.  On the resulting dialog box click bind to a new member(see below)  Click create Field  Click ok  Repeat the same steps to create a field for the BeforeProperties. With that achieved, it’s time to populate the if conditions methods and determine their result based on the value of the Status. Open the IfStatusApproved method you created earlier for the ifApproved ifelse branch and enter the following: private void IfStatusApproved(object sender, ConditionalEventArgs e) { string status = onWorkflowItemChanged1_AfterProperties1["Status"].ToString(); if (status == "Approved") { e.Result = true; } else { e.Result = false; } }  Repeat a Similar thing for the ifRejected Condition and apply the following: private void IfStatusRejected(object sender, ConditionalEventArgs e) { string status = onWorkflowItemChanged1_AfterProperties1["Status"].ToString(); if (status == "Rejected") { e.Result = true; } else { e.Result = false; } }
  • 12. Both methods sought to test the values in the status and based on that execute the conditions. Let’s apply the activities that will execute tasks based on the conditions:  Login the activity,  Sending a mail and  Completing/terminating the workflow Add the following activities from the tool box to both branches :  logToHistoryListActivity  sendmail  TerminateActivity Rename them appropriately
  • 13.  Let’s add an ifelse branch that will be responsible for sending mail to the accounts department when the workflow is initiated by an employee. o Add an ifelse branch, rename it to ifInitiated, add a log activity history and send email to it. Also add its correlation token and condition, you can use the method name ifStatusInitiated, and as done above specify the content below for the method. private void ifStatusInitiated(object sender, ConditionalEventArgs e) { string status = onWorkflowItemChanged1_AfterProperties1["Status"].ToString(); if (status == "Initiated") { e.Result = true; } else { e.Result = false; } } Your Workflow Design should look like:
  • 14. Now let’s work on the content of the ifelse branches. The Logs are logged automatically they need no codes/method, the activity terminate also have predefined task hence they need no methods, but the send mail do, so let’s complete that.  Define CorrelationToken for the send mail activities as was done earlier foronworkflowitemchanged.  Generate Handlers for the sendApprovalEmail o To achieve this:  Right Click on sendApprovalEmail  Click Generate Handlers
  • 15.  Type the following into the method: private void sendApprovalEmail_MethodInvoking(object sender, EventArgs e) { //Create an Item object based on our List SPListItem item = onWorkflowActivated1.WorkflowProperties.Item; //get the Employee Field Colunm from our List SPFieldUser assignedto = (SPFieldUser)item.Fields["Employee"]; //get the field value content of Accountant Clerk SPFieldUserValue user = (SPFieldUserValue)assignedto.GetFieldValue(item["Employee"].ToString()); //get the Requested Date Field Colunm from our List SPFieldDateTime requestedDate = (SPFieldDateTime)item.Fields["Requested Date"]; //get the field value content of Requested Date string rdt = requestedDate.GetFieldValue(item["Requested Date"].ToString()).ToString(); //get the Amount Field Colunm from our List SPFieldCurrency amount = (SPFieldCurrency)item.Fields["Amount"]; //get the field value content of Amount string amt = amount.GetFieldValue(item.Fields["Amount"].ToString()).ToString(); //get employee email, assign mail subject, and body string assigneeEmail = user.User.Email; sendApprovalEmail.To = assigneeEmail; sendApprovalEmail.Subject = "Advance Salary Request Approved"; sendApprovalEmail.Body = "Salary Advance Request with ID " + onWorkflowActivated1.WorkflowProperties.Item.ID.ToString() + ".n Requested Date :" + rdt + ".nn Amount Requested :"+amt+".nn Has been Approved.";
  • 16. }  Generate Handlers for the sendRejectedEmail o To achieve this:  Right Click on sendRejectedEmail  Click Generate Handlers  Type the following into the method: private void sendRejectedEmail_MethodInvoking(object sender, EventArgs e) { //Create an Item object based on our List SPListItem item = onWorkflowActivated1.WorkflowProperties.Item; //get the Employee Field Colunm from our List SPFieldUser assignedto = (SPFieldUser)item.Fields["Employee"]; //get the field value content of Accountant Clerk SPFieldUserValue user = (SPFieldUserValue)assignedto.GetFieldValue(item["Employee"].ToString()); //get the Requested Date Field Colunm from our List SPFieldDateTime requestedDate = (SPFieldDateTime)item.Fields["Requested Date"]; //get the field value content of Requested Date string rdt = requestedDate.GetFieldValue(item["Requested Date"].ToString()).ToString(); //get the Amount Field Colunm from our List SPFieldCurrency amount = (SPFieldCurrency)item.Fields["Amount"]; //get the field value content of Amount string amt = amount.GetFieldValue(item.Fields["Amount"].ToString()).ToString(); //get employee email, assign mail subject, and body string assigneeEmail = user.User.Email; sendApprovalEmail.To = assigneeEmail; sendApprovalEmail.Subject = "Advance Salary Request Rejected"; sendApprovalEmail.Body = "Salary Advance Request with ID " + onWorkflowActivated1.WorkflowProperties.Item.ID.ToString() + ".n Requested Date :" + rdt + ".nn Amount Requested :" + amt + ".nn Has been Rejected."; }  Also generate Handlers for the sendInitiatedEmail o To achieve this:  Right Click on sendInitiatedEmail  Click Generate Handlers  Type the following into the method:
  • 17. private void sendInitiatedEmail_MethodInvoking(object sender, EventArgs e) { //Create an Item object based on our List SPListItem item = onWorkflowActivated1.WorkflowProperties.Item; //get the user Field Colunm from our List SPFieldUser assignedto = (SPFieldUser)item.Fields["Accountant Clerk"]; //get the field content of Accountant Clerk SPFieldUserValue user = (SPFieldUserValue)assignedto.GetFieldValue(item["Accountant Clerk"].ToString()); string assigneeEmail = user.User.Email; sendApprovalEmail.To = assigneeEmail; sendApprovalEmail.Subject = " Salary Advance Request "; sendApprovalEmail.Body = "Advance Salary Request <br/><br/>Request ID:" + onWorkflowActivated1.WorkflowProperties.Item.ID; } That’s all. We can now build and deploy. Simply right click on the project and choose build, repeat the same steps but choose deploy to deploy it to the SharePoint server .see below. From the Site collection features of our SharePoint server you can see our new feature running
  • 18. We can have our workflow started by creating item on the Advance Salary List.
  • 19. Until we meet a gain from me to you its Nkoma…….. Download complete sandboxed project here.