Solved

Assessment for Nintex Forms with JavaScript included

  • 22 June 2021
  • 6 replies
  • 222 views

Badge +4

Hi folks.

we are preparing a migration for a client from SP2013 on-prem to SPO. In order to have a better understanding of situation we would like to create a script querying where Nintex Forms are used.

We will use ShareGate to perform the migration and in few test we faced issues for forms which are using custom JavaScript functions (included in the form and referencing to external js files.
Another question to answer is if it is a responsive or classic form, as the responsive cannot be migrated automatically to Nintex Online.
Long story short, we would like to ask if it is possible to create a list and query following properties:

  1. go through defined site collections
  2. find all existing Nintex Forms
  3. get if it is a responsive/classic form
  4. get if JS is used (inline or referenced)

Ideally it would be possible to do it from the client side, as we are not farm administrators. But if this is the only way, we can execute the script with them together.

 

Are there corresponding web services / object models / whatever... that we could utilize to get this information?

 

Any hint/help is very appreciated. Thanks!

icon

Best answer by Anatoli 26 August 2021, 09:47

View original

6 replies

Userlevel 3
Badge +12

Hi Anatoli,


We had a similar requirement to find the responsive forms when migrating to SPO using Sharegate as Sharegate cannot migrate the responsive forms to SPO and there is no direct way to get the responsive form details sometime back in 2020.


Whatever is present in a Nintex form is stored in xml file. When compared the xml of classic and responsive form, we saa an element,  <IsResponsive>false</IsResponsive> for classic form, <IsResponsive>true</IsResponsive> for responsive forms.  And this xml is stored in the "NintexForms" database, "NM_Form" table, "FormXml" column. 


Then we queried Nintex Database with the following SELECT statement to find all responsive forms


SELECT * FROM [NintexForms].[dbo].[NM_Form] where [FormXml] like '%<IsResponsive>true</IsResponsive>%'


The above statement gives Site Id, List Id and List Name. From these details, you can have a PowerShell script to query the site title from web site Id. 


$webSiteId = 'xxxxxxxxxxxxxxxxxxxxx'


Get-SPWeb | Where-Object {$_.Id -eq $webSiteId} | Select Url


$siteId is the web id from SQL output


If you have lot of web site ids in the SQL output, have all them in CSV and loop thru them.


 


Similarly, there should be a way to find if the script is present in the xml file, search for <script> tag in xml file of Nintex Form. We had very few Nintex forms with script and we already know what they are.


 


PowerShell script to get all lists with Nitex Forms:






#Get all webs in a site collection to $webs
#loop thru each web
foreach($web in $webs)
{

$lists = $web.Lists
foreach($list in $lists)
{
foreach ($ct in $list.ContentTypes)
{
#check if Nitnex form
if ($ct.NewFormTemplateName -eq "NFListEditForm")
{
$nintexFormItem = New-Object System.Object
$nintexFormItem | Add-Member -MemberType NoteProperty -Name "Site URL" -Value $web.Url
$nintexFormItem | Add-Member -MemberType NoteProperty -Name "List Title" -Value $list.Title
$nintexFormsInventory += $nintexFormItem
}

}

}


}
#Export output to csv
if($nintexFormsInventory -ne $null)
{
$nintexFormsInventory | Export-Csv "filename.csv"
}


Note: Please excercise caution when trying out this solution. We tried this first on our development server, and then on production. As it requires using a SELECT statement only, no harm, but it is upto you whether to follow this fix or not.</strong></p></div>





Badge +4

Hi kchaluvadi,


thank you for this detailed answer, it seems to be very helpful. For our purposes the SQL query seems to return enough information, as we can join the site name from different data.


I hope the query will return nintex forms attached to content types directly too, in case if the content type is not used, but actually I think this is nice-to-have.


 


I will test it. Thank you again, very appreciated!


Best regards
Anatoli

Badge +4

Hi @kchaluvadi,


it took a while, but I had finally some time to test your approach. I thought it would be a good idea to test the query on our test environment before contacting the clients admin team.
I'm very wondering as the corresponding table is empty, same applies to the other tables, they are all empty in the Nintex Forms database. The only table that has one entry is the DatabaseVersion.
I've also ensured this is the right database which is configured in central administration.


I've found some information saying the forms are just saved as xml in a hidden list on SharePoint, but it might be outdated information.


Any idea about this?



Best regards


Anatoli

Badge +4

Correct my if I'm wrong, but it seems the database is for Nintex Forms Live only. If you are not using Live feature, your forms will not appear in the SQL database.


So I assume I need to utilize PowerShell and call Nintex Forms web service to retrieve the XML form definitions site by site, list by list, content type by content type...

Userlevel 3
Badge +12

I am wondering why the table in Nintex Forms database is empty.  Give a try creating a Nintex form and see if that atlest appears? I did this almost one and half year ago, not sure if something is changed in between.

Badge +4

Finally it is our solution: PowerShell script iterating through our site collections, subsites, and lists/libs with PnP, than downloading form definition with Get-PnPFile as XML and evaluating it on the XML properties.


Works quite good.


 


Thank you @kchaluvadi for your thoughts and ideas!

Reply