Friday, September 9, 2011

Add and Delete an Item from one list to another list in Sharepoint 2010?

Using SharePoint workflow we can control the items of one list to another list. For ex we need to shortlist the candidate based on the condition of Project Assigned or not. Generally we will maintain a list of candidates and now we have to create another list which contains the candidates who were not assigned the project. So it will help to concentrate on those candidates separately to assign the project as soon.
 Create a list in sharepoint site
 Goto to SiteAction -> moreoption -> List -> Custom List
 Enter the name as CandidateList
 Click create to complete
 Create some fields in candidate list with the following details
Change the title name as CandidateName
 Create the columns under the below category
v  E-mail id – Single line of text
v  Address   - Multiple line of text
v  Project Assigned –Choice(yes,No)
 Follow the Step:1 and Step:2 to create second list named HotList Candidate.

Open the sharepoint designer
 Under the navigation select workflow
       Choose candidate list from the list Workflow option
       Enter the name for the new workflow
   After enter into the edit page
    Select the condition of “If Current item field equals value”
   Select the field name as Project Assigned and value as no.

 Under the condition
 Select the action as “copy list item”
  Leave the current list in the first list
 And select Hot list candidate  in the second option
 Now we have to give the else condition
 Again select the condition of “If Current item field equals value”
Select the field name as Project Assigned and value as yes

 Under this else condition
 Select the action as “Delete Item”
 Select the hotlist Candidate under the list option
 Choose the field as project Assigned and value as no

    Save and Publish the workflow to complete the process.
    check the start options in the workflow as below

 Open your site and add an item in the candidate list.
  when you select ‘no’ in the project assigned field it send a copy of that item into the hotlist candidate list.
 Also when you edit that item and changed the field as ‘yes’ it delete the item from hotlist candidate list. You can check very good SharePoint 2010 articles.