locked
Fetch values from list in workflow for SharePoint 2013 for VS 2012 RRS feed

  • Question

  • HI,

    I am trying to create a workflow in VS 2012 for SharePoint 2013. I have associated the workflow to custom list.

    I have another list (configuration list), which contains columns "Title" and "Value". The configuration list contains multiple items.

    For example:

    Title                                        value

    ccaddress                             some email value

    emailsubjectforApprover         test email

    How to fetch the values of the configuration list in the workflow?

    Thanks

    Saturday, January 11, 2014 6:47 AM

Answers

  • Hello Ven..

    its easy don't worry lets go step by step ok.

    You want the the value of one item with title "ccadress" from List named  "config " in your workflow Ok lets start

    1. From the toolbox insert a LookupSPListItemId  and go to is properties. you will see some thing like this image

    2. here Set List Id either from selecting Dropdown or click on Elipsis icon and enter Guid.Parse("Guid of list config from which you want to access value>")

    3. you want to filter from Title Column so in Property Name Select Title , in Property value type your Value here in your case type "ccadress"

    4. now create a Varriable of type int32 see i have created with the name ItemId . in Visual Studio you can create Varriable in Workflow . in left side there will be a strip . on the strip "Varriables Arguments Imports will be writen" just click on varriables and you can create varrible scope it to sequence. 

    5. see Results dropdown just select this variable. now result will be assigned in this variable ok

    6. and yes of cource you have done. now insert LookupSpListItem activity and from its properities

    7. Set item id to the ItemId variable that you have created earlier and List Id to config List.

    8. Click on Get Properties , a dynamic Value box will be created click on Define from the box, a dialog box will show . on the top bar select ListItem of Config list (your list) . get your value. see image bellow how i have selected TestList just you need to select Config List Ok.

    Done you will Get the value in Value varriable.

    How it Works

    You have Fetched itemId of list item with lookupsplistitemid and then once you have item id you can look up that item.

    Hope it helps , Please Dont forget to mark as Answer



    Mukesh


    • Edited by Mukesh Tripati Wednesday, January 15, 2014 6:19 AM Corrected
    • Marked as answer by Dennis Guo Saturday, January 25, 2014 3:55 AM
    Wednesday, January 15, 2014 6:17 AM

All replies

  • Hello Ven..,

    In Vs 2012 There is an activity called GetSPListItems , insert GetSPListItems Activity.

    Then from properties Set the List Configuration List. From Item Set the Item you want.

    you will get the item


    Mukesh

    Saturday, January 11, 2014 7:30 AM
  • HI,

    Thanks for the reply.

    Is there any example site which shows the functionality.

    Thanks

    Saturday, January 11, 2014 10:24 AM
  • Hi Ven..

    I have used a name GetSPListItem which is Actualy LookUpSPListItem sory for that .

    Please see bellow article from msdn

    http://msdn.microsoft.com/en-us/library/dn456545.aspx

    Hope it will help u

    above link  is using  LookUpSPListItem and sets the list and Item property to current list and current item

    however you need to specify our own


    Mukesh

    Saturday, January 11, 2014 10:42 AM
  • Hi,

    I have used the Lookupsplistitem.

    Only thing is: To fetch the list value.

    Example: I have 2 columns : Title , Value.

    There are lot of records in the configuration list. I want to get the value which matches the Title "ccaddress".

    I am looking for such a functionality.

    Thanks


    • Edited by Venkatzeus Sunday, January 12, 2014 5:32 AM
    Sunday, January 12, 2014 5:31 AM
  • Hello Ven...

    if  you are  using LookUpSPListItems then it takes  two arguments one is ListId and other is ItemID which is GUID of item.

    Which ensures only one item will be there ok.

    prior to using LookSPListItem you should use LookupSPListItemId and fetch the Guid of item whose title is

    "ccadress"

    ok now if you have id of item you can use LookUpSPListItems to get its value Property.

    Hope it Helps.


    Mukesh

    Tuesday, January 14, 2014 9:11 AM
  • HI,

    Thanks for the reply. As you said:

    "prior to using LookSPListItem you should use LookupSPListItemId and fetch the Guid of item whose title is

    "ccadress" "

    How to get the guid of the item, which is in config list?

    Thanks

    Tuesday, January 14, 2014 2:34 PM
  • Hello Ven..

    its easy don't worry lets go step by step ok.

    You want the the value of one item with title "ccadress" from List named  "config " in your workflow Ok lets start

    1. From the toolbox insert a LookupSPListItemId  and go to is properties. you will see some thing like this image

    2. here Set List Id either from selecting Dropdown or click on Elipsis icon and enter Guid.Parse("Guid of list config from which you want to access value>")

    3. you want to filter from Title Column so in Property Name Select Title , in Property value type your Value here in your case type "ccadress"

    4. now create a Varriable of type int32 see i have created with the name ItemId . in Visual Studio you can create Varriable in Workflow . in left side there will be a strip . on the strip "Varriables Arguments Imports will be writen" just click on varriables and you can create varrible scope it to sequence. 

    5. see Results dropdown just select this variable. now result will be assigned in this variable ok

    6. and yes of cource you have done. now insert LookupSpListItem activity and from its properities

    7. Set item id to the ItemId variable that you have created earlier and List Id to config List.

    8. Click on Get Properties , a dynamic Value box will be created click on Define from the box, a dialog box will show . on the top bar select ListItem of Config list (your list) . get your value. see image bellow how i have selected TestList just you need to select Config List Ok.

    Done you will Get the value in Value varriable.

    How it Works

    You have Fetched itemId of list item with lookupsplistitemid and then once you have item id you can look up that item.

    Hope it helps , Please Dont forget to mark as Answer



    Mukesh


    • Edited by Mukesh Tripati Wednesday, January 15, 2014 6:19 AM Corrected
    • Marked as answer by Dennis Guo Saturday, January 25, 2014 3:55 AM
    Wednesday, January 15, 2014 6:17 AM
  • Can anyone explain, why I can't get "Name" property from document library item?

    I've added LookupSPListItem activity, configured it with input parameters as (current list) and (current item). Set result to "CurItemProperties" variable and then added GetDynamicValueProperties activity to read data from this variable.

    But in Properties dialog there is no property like Name or Title. I tried writing these properties by hand, but get no result. Though, for example, I can read other properties, like "__metadata/uri".

    Do I have to use some special syntax for reading the "Name" field falue?

    Monday, February 24, 2014 5:01 PM