locked
Get list item associated with the workflow? RRS feed

  • Question

  • Hi,

    I've found several blogs showing how to get the current list item that a workflow is processing, but they all relate to sharepoint designer, modifying the actions file etc.... I'm writing a pretty simple custom workflow and just need simple access to the current list item. I understand that I can't use the same SPContext as if I were using the site and web objects. Is there really no simpler way to get the current list item? I really don't need SPD involved at all, or do I need to modify the actions file regardless to get the current list item?

    Tuesday, February 22, 2011 7:25 PM

Answers

  • Hi,

     

    You can try accessing the workflowproperties.Item to get the item related to the current workflow.

     


    Thanks,
    Chanakya
    • Marked as answer by ChrisC_26 Wednesday, February 23, 2011 3:50 PM
    Wednesday, February 23, 2011 10:36 AM

All replies

  • Hi,

     

    You can try accessing the workflowproperties.Item to get the item related to the current workflow.

     


    Thanks,
    Chanakya
    • Marked as answer by ChrisC_26 Wednesday, February 23, 2011 3:50 PM
    Wednesday, February 23, 2011 10:36 AM
  • Hi,

    I think you want to access the items on which the workflow is currently running. Please correct me if I am wrong. Well, if this is the case then you write a program which will give you the items on which the status of the workflow is "In Progress". Each and every workflow status has a value. For eg the value for "In Progress" is 2, "Completed" is 5, "Failed on Start" is 1 etc. Write a caml query in your program which will give you the items having the column value (Workflow column) equals to 2. Like this, you can figure out that on how many items the workflow is still in progress.

    Regards

    Ginni - Microsoft Community Contributor

    [My SharePoint Blog]

    • Edited by Mike Walsh FIN Wednesday, February 23, 2011 9:57 PM Question already answered. Request for more information removed.
    Wednesday, February 23, 2011 2:55 PM
  • Hi ChrisC

     

    I had the same issue for last 3 days, so if you are still in teh same situation, i have the answer. U need to use the workflowProperties variable to collect the current context elements. such as current site, web , list and listitem.

    Sounds simple, but i had missed one sonfiguration out of my ingnorance, due to which i was even getting the "workflowProperties" as null too. I figured out i ad  to bind the OnWorkflowActivated Activity's property "WorkflowProperties" to the workflow's property "workflowProperty".

     

    Hope this make sense and it would help any other who would stumble on this post .

    Thursday, June 23, 2011 9:11 AM