2

I'm trying to get a list of workflow processes started after a given date. I am using PowerShell to call the core service API. I'm doing the below to get a list of active processes. that does give me a list of everything active, but if I open one of the process items, the Activities property only shows the current activity.

$filter = New-Object Tridion.ContentManager.CoreService.Client.ProcessesFilterData
$filter.ProcessType = 1
$proc = $client.GetSystemWideList($filter)
$p1 = $proc[1]
$activ = $p1.Activities
$activ.Count

result = 1

If I go and load the process item directly by id

$p1Full = $client.Read($p1.Id, (New-Object Tridion.ContentManager.CoreService.Client.ReadOptions))
$activFull = $p1Full.Activities
$activFull.Count

result = 3

So, Obviously when I'm getting the list, it's not getting the whole details on the processes. I tried adding

$filter.BaseColumns = 3

but that didn't make a difference. Given that we have hundreds of workflow processes running, I would rather not have to re-query to get the full object on each item just to detect the start date. Any other approaches I could use? or am I just missing something obvious?

2
  • You should be able to get the creation date of Process instance with this filer. Try to get XML list $client.GetSystemWideListXml($filter) and see what's in there. Creation date of process instance is not always the same as start date of the first activity, but it should at least give you some indication. Commented Aug 22, 2014 at 7:16
  • @user978511: thanks for the suggestion. that works for me Commented Aug 29, 2014 at 19:31

2 Answers 2

1

I was able to get this to work using user978511's suggestion to use GetSystemWideListXML. That does provide the creation date of the workflow process.

$filter = New-Object Tridion.ContentManager.CoreService.Client.ProcessesFilterData
$filter.ProcessType = 1
$client = Get-TridionCoreServiceClient
$xml = $client.GetSystemWideListXml($filter)
$doc = New-Object System.XML.XMLDocument
$doc.Load($xml.CreateReader())
$startDateString = Get-Date -Date $ModifiedDate -Format yyyyMMddHHmmss
$xpath = "//*[local-name()=`"Item`"][number(translate(@CreationDate,'-T:',''))>$startDateString]"
$xmlNodeSet = $doc.SelectNodes($xpath)
$ids = @()
if ($xmlNodeSet -ne $null)
{
    foreach ($node in $xmlNodeSet)
    {
        $ids += $node.ID
    }
}
0

That looks to me like pretty much typical core service behaviour. When you get a list back from a query, the objects are only partially populated, and you have to query them individually to get the full result.

So - the odds are that you aren't "missing something obvious". Having said that, it's always possible that there's a way of making the query such that it brings back more fully populated items.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.