cancel
Showing results for 
Search instead for 
Did you mean: 
Highlighted
Workflow Hero

Published Nintex form not replacing NewForm.aspx

Jump to solution

We have a list that has a Nintex form that only replaces the DispForm.aspx and EditForm.aspx but not the NewForm.aspx.  We want it to replace all three as is normal.  We first thought the problem was the fact that the list is missing the original-from-SharePoint NewForm.aspx form but creating a new NewForm.aspx and making that the default didn't solve the problem.  How can we get the published Nintex form to replace the SharePoint NewForm.aspx?

Tags (2)
Reply
2 Replies
Workflow Hero

Re: Published Nintex form not replacing NewForm.aspx

Jump to solution

We had to recreate the original NewForm.aspx page which cannot be done through SharePoint Designer (you can create a new NewForm.aspx but it won't work with Nintex) and couldn't be restored from backup as it had been deleted further back than our backups reached).  Instead, run the script found at http://blogs.technet.com/b/yashgoel-msft/archive/2013/08/30/recreating-default-display-edit-and-new-...  in PowerShell.  The script below was originally posted at the above address by Yash Goel on 30 Aug 2013 and reproduced here only in case the link breaks.

Following script recreates dispform.aspx, editform.aspx and newform.aspx of a list using PowerShell, useful in scenarios where we need to recreate these forms to fix issues induced due to upgrades

$url = Read-Host "Enter URL" 

do{
$listname = Read-Host "Enter List Name"
$web = get-spweb $url
$list = $web.lists[$listname]
$files = $list.rootfolder.files

#---------------------------- Delete Forms ----------------------

$form1 = $list.RootFolder.files | ?{$_.url -match "dispform.aspx"}

$form2 = $list.RootFolder.files | ?{$_.url -match "editform.aspx"}

$form3 = $list.RootFolder.files | ?{$_.url -match "newform.aspx"}

$form1.delete()
$form2.delete()
$form3.delete()

$list.update()

# --------------------------recreating --------------------------------

$editformurl = $list.RootFolder.ServerRelativeUrl + "/EditForm.aspx"
$dispformurl = $list.RootFolder.ServerRelativeUrl + "/DispForm.aspx"
$newformurl = $list.RootFolder.ServerRelativeUrl + "/NewForm.aspx"

$dispform = $files.add($dispformurl, [Microsoft.SharePoint.SPTemplateFileType]::FormPage)
$editform = $files.add($editformurl, [Microsoft.SharePoint.SPTemplateFileType]::FormPage)
$newform = $files.add($newformurl, [Microsoft.SharePoint.SPTemplateFileType]::FormPage)

$wpm = $editform.GetLimitedWebPartManager([System.Web.UI.WebControls.WebParts.PersonalizationScope]:Smiley Frustratedhared)
$wpm2 = $dispform.GetLimitedWebPartManager([System.Web.UI.WebControls.WebParts.PersonalizationScope]:Smiley Frustratedhared)
$wpm3 = $newform.GetLimitedWebPartManager([System.Web.UI.WebControls.WebParts.PersonalizationScope]:Smiley Frustratedhared)

$lfw1 = new-object ([Microsoft.SharePoint.WebPartPages.ListFormwebpart])
$lfw2 = new-object ([Microsoft.SharePoint.WebPartPages.ListFormwebpart])
$lfw3 = new-object ([Microsoft.SharePoint.WebPartPages.ListFormwebpart])

$ilist1 = [Microsoft.SharePoint.WebPartPages.IListWebPart]($lfw1)
$ilist2 = [Microsoft.SharePoint.WebPartPages.IListWebPart]($lfw2)
$ilist3 = [Microsoft.SharePoint.WebPartPages.IListWebPart]($lfw3)

$ilist1.ListId = $list.id
$ilist1.PageType = [Microsoft.SharePoint.PAGETYPE]:Smiley TongueAGE_EDITFORM;

$ilist2.ListId = $list.id
$ilist2.PageType = [Microsoft.SharePoint.PAGETYPE]:Smiley TongueAGE_DISPLAYFORM;

$ilist3.ListId = $list.id
$ilist3.PageType = [Microsoft.SharePoint.PAGETYPE]:Smiley TongueAGE_NEWFORM;

$wpm.AddWebPart($lfw1, "Main", 1)
$wpm2.AddWebPart($lfw2, "Main", 1)
$wpm3.AddWebPart($lfw3, "Main", 1)


$list.DefaultDisplayFormUrl = $dispformurl
$list.DefaultEditFormUrl = $editformurl
$list.DefaultNewFormUrl = $newformurl

$list.update()
}
while ($TRUE)
# # ===================
Reply
Workflow Hero

Re: Published Nintex form not replacing NewForm.aspx

Jump to solution

Very interesting. We had a similar issue and I deleted the list and recreated it. I gave up trying to figure it out.

0 Kudos
Reply