none
Sharepoint Workflow - Change multiple items in other list

    Question

  • Hi Everyone,

    SharePoint Newbie here... I'm currently working on a Sharepoint workflow in Sharepoint designer. Here is what I'm trying to acheive.

    • Workflow is based on List 1
    • Trying to update multiple items in List 2 based on information from Item in List 1 which is a "Choice (menu to choose from)" with mutliple items. (Field name "Deploy To:")

    WorkFlow Step (Update Item in List 2)

    List: "List 2"

    Set This Field: "Configuration Revision" To This Value: "Current Item: Release Revision"

    Find the List Item:

    • Field: "Environment Title"
    • Value: "Current Item:Deploy To:" (Deploy To: Choices, comma delimited)

    When I run the workflow with only one choice selected in the "Deploy To:" field, the workflow updates the "Configuration Revision" field in List 2 successfully, if there is more than one item selected in the "Deploy To:" Field, nothing in List 2 gets updated.

    Does this make sense or is there a better way that I can explain?

    Any assistance would be greatly appreciated.

    Thanks,

    Andrew



    Tuesday, June 05, 2012 6:53 AM

Answers

  • Hi AndrewGriffioen,

    I understand that you want to update item in List2 using a multiple selection Choice column in List 1 to  look up for the corresponding items .When achieving this using SharePoint designer workflow ,there are some limitations:

    1. In the ‘Find the List Item ’ section ,you operation used is ‘=’ .This operation cannot be modified to others like ‘contains’ .So when your Deploy To column have multiple selections ,the workflow will use the whole value to compare with the value of Environment Title column .So it won’t find any item matching the condition and won’t update too .
    2. When there are only one selection in the Choice column ,the workflow will be able to find the items in List2 whose Environment Title is equal to Deploy  To .But if there are multiple matching  items found in List 2  ,only the first matching  item will be updated .

    So in OOTB way ,you cannot update items in another list using a multiple selection column for looking up .You can create event handlers on List 1 to update item in List2 .

    Here is an example about the code you will need :

    using System;

    using System.Security.Permissions;

    using Microsoft.SharePoint;

    using Microsoft.SharePoint.Security;

    using Microsoft.SharePoint.Utilities;

    using Microsoft.SharePoint.Workflow;

    namespace ItemAddedValidation.EventReceiver1

    {

        public class EventReceiver1 : SPItemEventReceiver

        {

           public override void ItemAdded(SPItemEventProperties properties)

           {

               base.ItemAdded(properties);

               string deploy = properties.AfterProperties["Deploy_x0020_To"].ToString();

               string releaserevision= properties.AfterProperties["Configuration_x0020_ Revision "].ToString();

                           …..                    

                }

       }           

    }

    For more information about creating an item added event handler ,you can refer to this site:

    Chapter 9: Event Receivers (Part 2 of 2):  http://msdn.microsoft.com/en-us/library/ff713708(v=office.12).aspx#WSS2007_ItemEvent

    Thanks,

    Entan Ming

    TechNet Subscriber Support in forum

    If you have any feedback on our support, please contacttnmff@microsoft.com.


    Entan Ming

    TechNet Community Support

    Wednesday, June 06, 2012 3:13 AM

All replies

  • Hi AndrewGriffioen,

    I understand that you want to update item in List2 using a multiple selection Choice column in List 1 to  look up for the corresponding items .When achieving this using SharePoint designer workflow ,there are some limitations:

    1. In the ‘Find the List Item ’ section ,you operation used is ‘=’ .This operation cannot be modified to others like ‘contains’ .So when your Deploy To column have multiple selections ,the workflow will use the whole value to compare with the value of Environment Title column .So it won’t find any item matching the condition and won’t update too .
    2. When there are only one selection in the Choice column ,the workflow will be able to find the items in List2 whose Environment Title is equal to Deploy  To .But if there are multiple matching  items found in List 2  ,only the first matching  item will be updated .

    So in OOTB way ,you cannot update items in another list using a multiple selection column for looking up .You can create event handlers on List 1 to update item in List2 .

    Here is an example about the code you will need :

    using System;

    using System.Security.Permissions;

    using Microsoft.SharePoint;

    using Microsoft.SharePoint.Security;

    using Microsoft.SharePoint.Utilities;

    using Microsoft.SharePoint.Workflow;

    namespace ItemAddedValidation.EventReceiver1

    {

        public class EventReceiver1 : SPItemEventReceiver

        {

           public override void ItemAdded(SPItemEventProperties properties)

           {

               base.ItemAdded(properties);

               string deploy = properties.AfterProperties["Deploy_x0020_To"].ToString();

               string releaserevision= properties.AfterProperties["Configuration_x0020_ Revision "].ToString();

                           …..                    

                }

       }           

    }

    For more information about creating an item added event handler ,you can refer to this site:

    Chapter 9: Event Receivers (Part 2 of 2):  http://msdn.microsoft.com/en-us/library/ff713708(v=office.12).aspx#WSS2007_ItemEvent

    Thanks,

    Entan Ming

    TechNet Subscriber Support in forum

    If you have any feedback on our support, please contacttnmff@microsoft.com.


    Entan Ming

    TechNet Community Support

    Wednesday, June 06, 2012 3:13 AM
  • I have written two workflows on codeplex - one is https://rwomi.codeplex.com and one is https://umlisdw.codeplex.com/

    both allow you to execute a workflow action that executes over multiple items



    Please mark my response as an answer if appropriate.
    Learn.SharePoint.com

    Tuesday, August 20, 2013 10:23 PM