Import nintex user defined action

23/03/2015 12:35

In case we need to move nintex workflows using user defined actions between environments, they must keep the same User Defined Action guid. We have to use only UDA export in .uda file, not .nwf file. Following Id node value must be present in workflow .nwf file


<UserDefinedActionDefinition><Name>Task
Reminder User Defined
Action</Name><Id>22f40f51-5a61-44f5-9e67-c9d1d707a151</Id>


PS script to import user defined action

Inspired by great article sharepointrepairjoint.blogspot.com.au/2014/08/powershell-cmdlet-to-import-nintex-user.html


Add-PSSnapin microsoft.sharepoint.powershell -ErrorAction SilentlyContinue

$webUrl = "https://devapps.millennium.sk/sites/powerforms5"
$filePath = "C:\Users\lsevcik\Downloads\UDA_simple_adding7.uda";
$publish = $true


$web = Get-SPWeb $weburl

[System.Reflection.Assembly]::LoadWithPartialName('Nintex.Workflow') ' Out-Null  
$fs = New-Object System.IO.FileStream($filePath, [System.IO.FileMode]::Open, [System.IO.FileAccess]::Read, [System.IO.FileShare]::ReadWrite)
$ms = New-Object System.IO.MemoryStream
$fs.CopyTo($ms)
$fs.Close()
$fs.Dispose() 
$uda = [Nintex.Workflow.UserDefinedActions.UserDefinedAction]::Import($web, $ms, [Nintex.Workflow.ConfigurationScope]::Web)
$uda.Update($web, $publish, [Nintex.Workflow.Publishing.Scope]::SiteCollection, "")
$ms.Close()
$ms.Dispose()
"Completed"


#Config/Publishing Scope
# [Nintex.Workflow.Publishing.Scope]::Web (Site)
# [Nintex.Workflow.ConfigurationScope]::Site (SiteCollection)
# [Nintex.Workflow.ConfigurationScope]::Farm