Duplicate Workflows are found in Workflow Inventory

  • 26 March 2021
  • 0 replies
  • 509 views

Userlevel 3
Badge +8

Issue

After attaching a Nintex Content DB from another farm, and after opening the Nintex Workflow Inventory page, there maybe duplicate Workflows names.

 

Resolution

1. Retrieve the SiteID which has the duplicate Workfows, in the Workflow Inventory page.
2. Run the following Powershell Script from your Web Front End Server, and when prompted entry the SiteID

 

#                                         ### Nintex Workflow Statistics Query ###

#
#                   This script will use the Nintex Assembilies to query the Nintex databases for the total number of rows in the workflows with a specific SiteID, in the Nintex Content DB
# Prompts for the SiteID
#

#

#        Please ensure you run this script as Administrative account that has rights to each Nintex database
#

 

#Adding SharePoint Powershell Snapin
Add-PSSnapin Microsoft.SharePoint.PowerShell -EA silentlycontinue

# The Line below will suppress error messages, uncomment if you are seeing errors but still receiving results.

#$ErrorAction = 'silentlycontinue'

# Loading SharePoint and Nintex Objects into the PS session
[void][System.Reflection.Assembly]::LoadWithPartialName("Microsoft.SharePoint")
[void][System.Reflection.Assembly]::LoadWithPartialName("Nintex.Workflow")
[void][System.Reflection.Assembly]::LoadWithPartialName("Nintex.Workflow.SupportConsole")
[void][System.Reflection.Assembly]::LoadWithPartialName("Nintex.Workflow.Administration")
[void][System.Reflection.Assembly]::LoadWithPartialName("Nintex.Forms.SharePoint.Administration")

# Grab Nintex Config database name

$CFGDB = [Nintex.Workflow.Administration.ConfigurationDatabase]::OpenConfigDataBase().Database

# Creating instance of .NET SQL client
$cmd = New-Object -TypeName System.Data.SqlClient.SqlCommand

$cmd.CommandType = [System.Data.CommandType]::Text


# Begin SQL Query

cls

$siteid = Read-host -prompt "Enter Site ID"

$cmd.CommandText = "SELECT
               count(*) AS 'WFinstance' from workflows
               where siteid ='$siteid';" 

         
$indexes = @()

# Call to find all Nintex Content Databases in the Nintex Configuration Database, then execute the above query against each.
foreach ($database in [Nintex.Workflow.Administration.ConfigurationDatabase]::GetConfigurationDatabase().ContentDatabases)
{

$reader = $database.ExecuteReader($cmd)

# Creating a table
while($reader.Read())
{
$row = New-Object System.Object

#Adding Query results to table object
$row | Add-Member -MemberType NoteProperty -Name "Rows in Workflow progres table " -Value $reader["WFinstance"]
$row | Add-Member -MemberType NoteProperty -Name "NTXDB" -Value $database.SqlConnectionString.InitialCatalog

$indexes += $row
}
}
cls
#Print results on screen
$indexes  | FT -autosize
Write-host "Total Nintex Content DataBases:" $indexes.Count

 

3. Once you've identified which other Nintex Content DBs have data for this SiteID, use the NWAdmin command "MoveData" to move the Data from the incorrect Nintex Content DBs to the correct Nintex Content DB.

 

NWAdmin.exe -o MoveData -SiteID <site collection GUID>] [-SourceDatabase <connection string>] [-TargetDatabase <connection string>]

 

Replacing the <Site Collection GUID>, <Connection String> with the relevant values

 

Additional Information

The Nintex Workflow Inventory page will query all of the Nintex Content DBs in the farm for any records that match the current sideID
If there are several Nintex Content DBs with the same set of WorkflowData, then this will be shown as duplicates in the Workflow Inventory page.
 

Related Links

You can find more details of the command here: NWAdmin - Move Data

 


0 replies

Be the first to reply!

Reply