locked
How to append List2 data in List1 via Workflow in MOSS. RRS feed

  • Question

  • Hi Folks,

    I am using MOSS. I have 2 sharepoint list and I need to append List2 data in List1. But, List2 column name doesn't match with List1 column name. List2 column type match with List1 column type though. Which is the better way to accomplish this work. Will Sharepoint Designer (Workflow) provide this facility ? Please advice.

    Thanks,

    Chintan

    Tuesday, August 2, 2011 12:31 PM

Answers

  • Best way to achieve is to create custom event handler and attach with the list. like code below

     

     SPListItem objnewlyAddedJobs= properties.ListItem;
                    SPList order = objItem.ParenList.ParentWeb.Lists["List2"];
     
                            SPListItem orderNewItem = order.Items.Add();
                           
                            orderNewItem["Title"] = objnewlyAddedJobs.Title;
            orderNewItem["Col1"] =  objnewlyAddedJobs["col2"] //text field in order list      
                       
                            orderNewItem.Update();
                         


    Rahul Sharma -------------------------- Coding is all about passion !!!!!!
    Tuesday, August 2, 2011 6:38 PM