locked
If more than value is returned only the first value will be used. RRS feed

  • Question

  • I am getting the following warning message when I try to retrieve field values based on a condition in SharePoint Designer.

    The lookup that you defined is not guaranteed to return a single value. If more than one value is returned, only the first value will be used.

    But in my case, the condition satisfies multiple items and would like to return all the values. How to accomplish that ?

    Here is my list data. When a new project (say project2) is added to the 'Project' list, I would like to retrieve Name2, Name3 and Name4 from the 'Project Owners' list as they are listed as the Owners for the project2.

    I cannot set the 'Owner Name' field to allow multiple values due to other reasons.

    Projects:

    Project Name         Change Description

    project1                 My Change Desc1

    project2                 My Change Desc2

    Project Owners:

    Project Name               Owner Name

    project1                       Name1

    project1                       Name2

    project2                       Name2

    project2                       Name3

    project2                       Name4

    Thanks

    vmrao

    Wednesday, November 20, 2013 7:30 PM

Answers

  • Hi vmrao,

    You can run another workflow on Project Owner list when items are edited. This workflow will just simply copy and update the Owner Name in Project Owner 2 list with the values in Project Owner list. For the previous workflow which triggers on item creation, you will append to existing string where as here you will overwrite the existing string.


    Regards, Kapil ***Please mark answer as Helpful or Answered after consideration***

    • Marked as answer by vmrao Tuesday, November 26, 2013 6:10 PM
    Thursday, November 21, 2013 2:29 PM
  • Hi vmrao,

    Deletion is not a trigger that is handled by SPD workflows. For this you have to use event handlers. http://social.msdn.microsoft.com/Forums/en-US/ea6858a8-7633-4678-98bf-29b2eeea2dca/item-deleting-event-handler


    Regards, Kapil ***Please mark answer as Helpful or Answered after consideration***

    • Marked as answer by vmrao Tuesday, November 26, 2013 6:11 PM
    Tuesday, November 26, 2013 2:06 PM

All replies

  • That message pops up no matter what you do.

    If you were using SP2013, you'd be able to do a loop through the list. See this article for what you can do in 2007/2010:

    http://blog-sharepoint.blogspot.com/2010/01/sharepoint-looping-workflow-how-to-loop.html


    Andy Wessendorf SharePoint Developer II | Rackspace andy.wessendorf@rackspace.com

    Wednesday, November 20, 2013 7:44 PM
  • You cannot select/lookup multiple values from SPD workflow. This is by design. It always returns the first value it matches. You have asked the similar question in another post.

    What you can do is, when a new row is added to the Project Owners list, update another list (call it Project Owner 2) which has the list of projects and its Owners. Append the name of the owners to the project that is created in Project Owner list.

    Project Owners 2

    Project Name             Owner Name

    project 1                    Name1; Name2;

    project 2                    Name2; Name3; Name4

    Run your workflow against this list to look at the Owners. Hope this helps.


    Regards, Kapil ***Please mark answer as Helpful or Answered after consideration***

    Wednesday, November 20, 2013 7:50 PM
  • Thanks Kapil.

    Is there a best way to keep the Project Owners 2 List uptodate with the create/update/delete happening in Project Owners List ? I guess this is the most common alternative solution for this issue and an article might be there. Any references would be great.

    Thanks

    vmrao

    Wednesday, November 20, 2013 8:36 PM
  • Within the Projects list, you could've just had a people picker field that allows multiple selections

    Scott Brickey
    MCTS, MCPD, MCITP
    www.sbrickey.com

    Wednesday, November 20, 2013 9:04 PM
  • Scott,

    Thanks. As I mentioned in my first post ...

    I cannot set the 'Owner Name' field to allow multiple values due to other reasons.

    Wednesday, November 20, 2013 9:15 PM
  • Hi vmrao,

    You can run another workflow on Project Owner list when items are edited. This workflow will just simply copy and update the Owner Name in Project Owner 2 list with the values in Project Owner list. For the previous workflow which triggers on item creation, you will append to existing string where as here you will overwrite the existing string.


    Regards, Kapil ***Please mark answer as Helpful or Answered after consideration***

    • Marked as answer by vmrao Tuesday, November 26, 2013 6:10 PM
    Thursday, November 21, 2013 2:29 PM
  • Thanks. I am still not clear on how to handle the update and delete. Having another workflow for update makes sense.

    Suppose here is my data in two lists after creating some records.

    Project Owners

    Project Name             Owner Name

    project 1                    Name1

    project 1                    Name2

    project 2                    Name2

    project 2                    Name3

    project 2                    Name4

    Project Owners 2

    Project Name             Owner Name

    project 1                    Name1; Name2;

    project 2                    Name2; Name3; Name4

    In Project Owners list, If I update Name3 for project 2 to Name5, how do I know to update the Name3 substring with Name5 for project2 in Project Owners 2 list ? Workflow does not have any idea about the previous value (Name3), right ?

    It looks like I need an additional column in the 'Project Owners' list such as 'Previous Owner Name' and compare it against 'Owner Name' and use the same to do the replace substring operation.

    This will take care of keeping the data uptodate with the Update operation.

    But how to handle the Delete ? If Name3 for Project2 is deleted in 'Project Owner' list, how to delete it in the record for Project 2 in 'Project Owner 2 ' list ?

    Thanks

    vmrao



    • Edited by vmrao Thursday, November 21, 2013 6:03 PM
    Thursday, November 21, 2013 6:03 PM
  • Hi vmrao,

    Deletion is not a trigger that is handled by SPD workflows. For this you have to use event handlers. http://social.msdn.microsoft.com/Forums/en-US/ea6858a8-7633-4678-98bf-29b2eeea2dca/item-deleting-event-handler


    Regards, Kapil ***Please mark answer as Helpful or Answered after consideration***

    • Marked as answer by vmrao Tuesday, November 26, 2013 6:11 PM
    Tuesday, November 26, 2013 2:06 PM