none
How to access properties of running workflow 2013 instances? RRS feed

  • Question

  • Hi there,

    I am trying to figure out how I can access properties of a running workflow instance. I have created the following PowerShell:

    Add-PSSnapin microsoft.sharepoint.powershell
    $web = Get-SPWeb http://app-72b5c37f94da1d.apps.sharepoint2013.local/sites/appdev/SharePointWorkflowApp
    $wfm = New-object Microsoft.SharePoint.WorkflowServices.WorkflowServicesManager($web)
    $list= ($web.lists|where Title -eq "List1")
    $sub = $wfm.GetWorkflowSubscriptionService()
    $subscriptions = $sub.EnumerateSubscriptionsByList($list.ID)
    $inst = $wfm.GetWorkflowInstanceService()
    $instances= $inst.Enumerate($subscriptions[0])
    $instance= $instances[0]
    $instance.Status
    $instance.UserStatus
    $instance.Properties

    I am not able to retrieve the arguments or variables via this route. Only UserStatus is a valid working option at this point.

    The variables and arguments of the sequence which I have configured via Visual Studio 2013's Workflow Designer, resulted in the following xaml:

      <x:Members>
        <x:Property Name="EenArg" Type="InArgument(x:String)" />
        <x:Property Name="argument1" Type="x:String" />
        <x:Property Name="argument2" Type="InOutArgument(x:String)" />
        <x:Property Name="strArg" Type="InOutArgument(x:String)" />
        <x:Property Name="intArg" Type="InOutArgument(x:String)" />
        <x:Property Name="dateTimeArg" Type="InOutArgument(x:String)" />
      </x:Members>

    None of which are propagated via de Properties collection. 

    What am I missing here?



    • Edited by Carl in 't Veld Monday, May 19, 2014 7:08 PM added xaml fragment
    Monday, May 19, 2014 2:55 PM

All replies

  • Hi,

    To access the properties of a workflow instance, here is a blog with code demos for your reference:

    http://ranaictiu-technicalblog.blogspot.com/2013/05/sharepoint-2013-workflow.html

    Thanks

    Patrick Liang

    Forum Support

    Please remember to mark the replies as answers if they help and unmark them if they provide no help. If you have feedback for TechNet Subscriber Support, contact tnmff@microsoft.com



    Patrick Liang
    TechNet Community Support

    Tuesday, May 20, 2014 2:13 AM
    Moderator
  • Thanks for sharing this blog - interestingly, if you review the comments thread of this blog, the same question as mine is asked: how to access information from running instances.

    I'll crosspost on StackOverflow as well. I hope Microsoft officials can clarify.

    https://stackoverflow.com/questions/23868217/how-can-i-access-properties-from-a-running-workflow-2013-instance-using-csom


    • Edited by Carl in 't Veld Monday, May 26, 2014 10:37 AM stackoverflow link included
    Monday, May 26, 2014 10:32 AM
  • Hi,

    Did you figure out a way to get the variables from a running instance ?

    Thanks,

    Monday, April 27, 2015 11:44 PM