none
CreateListItem Action at work flow not trigger Event reciever RRS feed

  • Question

  •  

      Hello ,

    • I have two Lists (List1 , List2).
    • I have attached Workflow by SharePoint designer to List 1 .
    • I have attached event receiver (Item was added) to list 2 .
    • In the workflow . I use "CreateListItem"  to create new item in list 2.
    • I have test the work flow . The item is added in List 2 , but the Event receiver not triggered .
    • if I Create new item in List2 from browser , the event receiver is triggered.

         so  why  "CreateListItem" action not triggered event receiver ?

        Thanks


    ASk

    Monday, October 27, 2014 2:05 PM

Answers

  • Hi himo,

    I made a test in my environment and when I start workflow in List1, then the event receiver in List2 is Triggered.

    Here are my test steps:

    1. Create a workflow for List1 in SharePoint Designer using CreateListItem action set the Title field to "Test" which is in List2.

    2. Create an event receiver for List2 with the below code

            public override void ItemAdded(SPItemEventProperties properties)
            {
                string siteUrl = "http://sp2013sps/sites/testdevsite";
    
                ClientContext clientContext = new ClientContext(siteUrl);
                List oList = clientContext.Web.Lists.GetByTitle("List2");
                ListItem oListItem = oList.GetItemById(1);
    
                oListItem["Title"] = "My Updated Title.";
    
                oListItem.Update();
    
                clientContext.ExecuteQuery(); 
                
                base.ItemAdded(properties);
            }
     

    3. Deploy the event receiver.

    4. When I execute the workflow in List1, then the title field in List2 will be updated to "My Updated Title". The event receiver has been triggered.

    I suggest you recreate a new List and follow the steps to above to check whether it works.

    Best Regards


    Zhengyu Guo
    TechNet Community Support



    Tuesday, October 28, 2014 6:04 AM