Skip to main content

In our Test System, we have some lists with multiple workflows. Does anyone know of way to import all of the workflows into lists with a PowerShell Script?

We have one main list with over 10 workflows and don't relish the thought of adding these one at a time through our multiple stage environments.

This was my part of my response from support:

Greetings Stephan,
Regarding your questions:

1.  Need to know a procedure for move a list with a lot of Nintex Workflows to another site without exporting and importing the Workflows one by one. (Preferably something with PowerShell)
a) You can try using this PowerShell to export workflows, you will need to modify it to see if it fits your needs:
  https://community.nintex.com/community/build-your-own/nintex_gallery/blog/2016/04/14/powershell-script-to-export-all-workflows-to-nwf-files
 

This approach uses our NWAdmin.exe tool with -ExportWorkflow switch, more info found here:
  https://community.nintex.com/docs/DOC-1026
  However to import them back in there is no way to do this programmatically using the above approach.

b) Another way you could attempt to do this is using our Nintex Workflow 2013 SDK: http://help.nintex.com/en-US/sdks/SDK2013/

http://help.nintex.com/en-US/sdks/SDK2013/#Operational/SDK_NW_OPS_WorkflowsExpImp.htm%3FTocPath%3DNintex%2520Software%2520Development%2520Kit%7CNintex%2520Workflow%25202013%2520Software%2520Development%2520Kit%7CWorking%2520with%2520the%2520Nintex%2520Workflow%25202013%2520SDK%7CWorking%2520with%2520workflows%7C_____2

c) We also recommend reaching out to our Nintex Community for ideas on how this can be done:  https://community.nintex.com/

Hi,

You could use PowerShell for this, the script below takes input parameters of the web url, the path to the .nwf file, the list name to publish it to and the workflow name.

param(
[Parameter(Mandatory=$true)][string]$WebURL = "",
[Parameter(Mandatory=$true)][string]$WorkflowFile = "",
[Parameter(Mandatory=$true)][string]$ListName = "",
[Parameter(Mandatory=$true)][string]$WorkflowName = ""
)

add-pssnapin microsoft.sharepoint.powershell

#Get the Target Site
$Web=Get-SPWeb $WebURL

$WebSrvUrl=$WebURL+"/_vti_bin/nintexworkflow/workflow.asmx"

$proxy=New-WebServiceProxy -Uri $WebSrvUrl -UseDefaultCredential

$proxy.URL=$WebSrvUrl

#Get the Workflow from file
$NWFcontent = get-content $WorkflowFile
$proxy.PublishFromNWFXml($NWFcontent, $ListName ,$WorkflowName, $true)
write-host "Workflow $WorkflowName Published to: "$List

Jan


Will definitely try this. Thanks.


Works good. I had to alter some logic for site workflows:

I stick "None" in the List Parameter for Site Workflows and I changed the logic as follows:

param(

[Parameter(Mandatory=$true)][string]$WebURL = "",

[Parameter(Mandatory=$true)][string]$WorkflowFile = "",

[Parameter(Mandatory=$true)][string]$ListName = "",

[Parameter(Mandatory=$true)][string]$WorkflowName = ""

)

add-pssnapin microsoft.sharepoint.powershell -ErrorAction SilentlyContinue

cls

#Get the Target Site

$Web=Get-SPWeb $WebURL

$WebSrvUrl=$WebURL+"/_vti_bin/nintexworkflow/workflow.asmx"

$proxy=New-WebServiceProxy -Uri $WebSrvUrl -UseDefaultCredential

$proxy.URL=$WebSrvUrl

#Get the Workflow from file

$NWFcontent = get-content $WorkflowFile

if ($ListName -eq "None")

    {

     $proxy.PublishFromNWFXml($NWFcontent, $null, $WorkflowName, $true) 

    }

    else

    {

        $proxy.PublishFromNWFXml($NWFcontent, $ListName ,$WorkflowName, $true)

    }

write-host "Workflow $WorkflowName Published to: "$ListName

Here are a few call strings:

#C:_ps1WorkFlowsCopyNintexWorkfl#owtoNewList.ps1 http://hcmsspd08 "C:UserssonisickDesktopOCRsList WorkflowsStop_OCR_Reviews.nwf" OCRs Stop_OCR_Reviews

#C:_ps1WorkFlowsCopyNintexWorkflowtoNewList.ps1 http://hcmsspd08 "C:UserssonisickDesktopOCRsSite WorkflowsStart_OCR_Action.nwf" None Start_OCR_Action.nwf

C:_ps1WorkFlowsCopyNintexWorkflowtoNewList.ps1 http://hcmsspd08 "C:UserssonisickDesktopOCRsList WorkflowsTest_Simple_2.nwf" SimpleList Test_Simple_2

One interesting thing I guess I hadn't thought about especially for Site Workflows is that if every list and field it references is not in place--it marks it as unpublished.


Reply