SharePoint – Nintex – finding the number of actions left on your license

Nintex workflow has a number of different ways you can license their products. For on-premises installations Nintex have had a server based license for a long time. Since Nintex Workflow has appeared in office 365 they have had a different licensing model which makes the number of workflows and action relevant. they offer this model both in Office 365 and for on-premises solutions.

I’m not going to go into the details here, but imagine that you need to know how many actions you have left on your license? In my case I’m working with the on-premises version of SharePoint of one of Triad’s customer. I’m running SharePoint 2013.

So this morning I started manually counting the steps. Half way through I fell asleep so this didn’t work very well.

counting-sheep

The better solution is to use PowerShell to count the number of actions in the workflow.

First of I exported my workflow giving me a .nwl file.

Then I read the content of the file using the following lines of PowerShell.

[xml]$xmlWorkflow = Get-Content C:\temp\Submit_documents.nwf

[xml]$xml = $xmlWorkflow.ExportedWorkflowWithListMetdata.ExportedWorkflowSeralized

$xmlWorkflowRootActionsConfig = $xml.ExportedWorkflow.Configurations.ActionConfigs

I now have some Xml contianing the action object.  then I look throguh the xml and display the total number found.

$count = 0;

foreach ($actionConfig in $xmlWorkflowRootActionsConfig)
{
$subcount = doCount($actionConfig.NWActionConfig)
$count = $count + $subcount

}

Write-Host $count

Just one more thing to do.  impleemnt a doCount function that takes the Xml for a number of Actions (NWActionConfig) from my xml

In short when you add an action to a Nintex workflow additinal action are being created. These actions include:

  • Nintex.Workflow.Activities.Adapters.NWState2Adapter
  • Nintex.Workflow.Activities.Adapters.WFSequenceAdapter
  • Nintex.Workflow.Activities.Adapters.WFIfElseBranchAdapter
  • Nintex.Workflow.Activities.Adapters.NWSwitchBranchAdapter

There might quite well be more than the above list, but I only found the above.

function doCount($xml)
{

$count = 0
foreach ($xmlPart in $xml)
{

if ($xmlPart.ChildActivities -ne $null)
{

$subcount = doCount($xmlPart.ChildActivities.NWActionConfig)
$count = $count + $subcount
}

if ($xmlPart.TLabel -ne $null -and $xmlPart.TLabel -ne “” )
{
if ($xmlPart.Type -eq “Nintex.Workflow.Activities.Adapters.NWState2Adapter” )
{
#Ignore this
}
else
{
$count++
}

}
else
{
if($xmlPart.Type -eq   “Nintex.Workflow.Activities.Adapters.WFSequenceAdapter” -or $xmlPart.Type -eq “Nintex.Workflow.Activities.Adapters.WFIfElseBranchAdapter” -or $xmlPart.Type -eq “Nintex.Workflow.Activities.Adapters.NWSwitchBranchAdapter”)
{

#Ignoring
}
else
{
#Ignoring

Write-Host -ForeGroundColor Red “Please consider adding ” $xmlPart.Type ” To the above list”
}

}

}

return $count
}

Once you run the above script you will be able to get the number of tasks withing seconds.

Advertisements


Categories:Nintex Workflow, PowerShell, SharePoint, SharePoint 2013

Tags:

4 replies

  1. Hi,
    Interesting blog post.
    Have you tried to analyze your workflow with this tool: https://workflowanalyzer.codeplex.com/
    What does the Action Count say and does it match with your result?

    Like

    • Hi Raphael,
      I wasn’t aware of that tool. Interesting the tool gave me 123 actions where I got 119 actions. It looks like the tool doesn’t ignore some of the invisible actions.

      Like

      • Ok, so we then better use the Workflow Analyzer to get an Impression of how many Actions are in use. I think it’s not trivial to get to know exactly how many Actions are left with my subscription.

        Like

      • I had a further look into the ‘missing’ actions. My script is excluding the Nintex.Workflow.Activities.Adapters.WFSequenceAdapter actions which Nintex adds in when multiple actions appear in a condition action to bundle the actions in each of the two branches.

        Like

Leave a Reply to Raphael Cancel reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.

%d bloggers like this: