question

johnjohn-0472 avatar image
0 Votes"
johnjohn-0472 asked MichaelHan-MSFT answered

My Create & Edit list forms are rendering using the modern UI although we have customize them using Script Editor web part

We have migrated 3 custom lists from SP 2013 to classic team site inside SP online, now the 3 lists have the following main settings:-

1) we have customized the list forms (Create & Edit) using Script Editor web parts, as follow:-

83815-customized.png

2) for the list settings >> we define to render based on the site settings (which is to use modern UI):-

83841-defa.png

so now the expected behavior is that the list views will render using the modern UI + But when we create/edit the list items the Create & Edit forms will render using the classic experience. Now this is working as expected for 2 lists. but is failing for the third list.. where on the third list the Create & Edit forms will render using the modern UI, although they have customized the forms using script editor web parts.. any advice on this?


office-sharepoint-online
customized.png (35.4 KiB)
defa.png (11.2 KiB)
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

MichaelHan-MSFT avatar image
0 Votes"
MichaelHan-MSFT answered johnjohn-0472 commented

Hello, @johnjohn-0472 ,

The similar question is asked here: https://github.com/SharePoint/sp-dev-docs/issues/6157. It's the MC222880:

Changes in classic form customizations in modern lists and libraries
Published date: 25 Sep 2020

We are changing how customized forms work inside SharePoint lists and libraries that will affect tenants using the SharePoint classic experience.

Key points

Timing: late October to late November
Roll-out: tenant level
Control type: user control
Action: review and assess by October 25, 2020
How this will affect your organization

Classic list and library forms support the following customizations:

  • Set the ContentType.EditFormUrl or ContentType.NewFormUrl properties to point to a custom form URL

  • Adding a Content editor web part or other web part to the form page

  • By adding a JSLink to one or more fields that appear on the form


Today, when one of these three customizations exists on a form inside a list or library that's configured to use the SharePoint modern experience, those forms will continue to render in classic to ensure customizations are visible to all users.
With this change

All customizations in the above list that were in place before October 25, 2020 will continue to render in the classic SharePoint experience.
For customizations created after October 25, 2020:

  • List item one customizations will continue to render in the classic experience

  • List items two and three customizations will no longer render in the classic experience by default
    What you need to do to prepare

This change affects only SharePoint list and form customizations after October 25, 2020. Therefore, your users need to take action only if they create new classic form customizations after October 25, 2020.

If your users have a list or library forms customized using methods two or three above, they can ensure it continues to fall back to classic by setting an EditFormUrl or NewFormUrl property to point to the existing form URL.

Users can also configure an entire list or library to use classic mode using Advanced settings

  • Navigate to the list that you want to use classic mode.

  • Select Settings Gear button and then select List Settings

  • Select Advanced Settings

  • Change the “List experience” setting to “Classic experience.”




So here are two options for you:

  1. Set an EditFormUrl or NewFormUrl property to point to the existing form URL.

  2. Change the “List experience” setting to “Classic experience.”



If an Answer is helpful, please click "Accept Answer" and upvote it.
Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.



· 4
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

Hi @johnjohn-0472 ,

You are right. Then Set an EditFormUrl or NewFormUrl property to point to the existing form URL is your only option.

1 Vote 1 ·

@MichaelHan-MSFT ok thanks a lot for your help.

0 Votes 0 ·

@MichaelHan-MSFT thanks for the detailed reply. so since i need to have the list view render using modern UI (to benefit from the modern filtering and modern search), while i want to render the Edit/New forms using classic UI, then i need to chose this option:-

Set an EditFormUrl or NewFormUrl property to point to the existing form URL.

Is this correct? while i will have the “List experience” set to “Default experience for the site”? is this correct?

0 Votes 0 ·

@MichaelHan-MSFT Also i tried to set and Edit and New form url, but i got this error:-

 PS C:\WINDOWS\system32> Connect-PnPOnline -url https://****.sharepoint.com/sites/TGroupIntranet -UseWebLogin
 PS C:\WINDOWS\system32> $list = Get-PnPList "User Feedback System"
 PS C:\WINDOWS\system32> $list.ContentTypes[0]
 PS C:\WINDOWS\system32> $list.ContentTypes[0].NewFormUrl = "https://******.com/sites/TGroupIntranet/Lists/UserFeedbackSystem/NewForm.aspx"
 The property 'NewFormUrl' cannot be found on this object. Verify that the property exists and can be set.
 At line:1 char:1
 + $list.ContentTypes[0].NewFormUrl = "https://tgroupinfra.sharepoint. ...
 + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
     + CategoryInfo          : InvalidOperation: (:) [], RuntimeException
     + FullyQualifiedErrorId : PropertyNotFound

0 Votes 0 ·
MichaelHan-MSFT avatar image
0 Votes"
MichaelHan-MSFT answered

Hi @johnjohn-0472 ,

You could use csom powershell to set the NewFormUrl. Below is my sample for you:

 $webUrl = "https://teannt.sharepoint.com/sites/test"
    
 $listName = "TestList2"
 $UserName="michael@teannt.onmicrosoft.com"
 $Password ="xxxxxx"
      
 #Setup Credentials to connect
 $Credentials = New-Object Microsoft.SharePoint.Client.SharePointOnlineCredentials($UserName,(ConvertTo-SecureString $Password -AsPlainText -Force))
    
    
 $context = New-Object Microsoft.SharePoint.Client.ClientContext $webUrl
 $context.Credentials = $Credentials
    
 $web = $context.Web
 $list = $web.Lists.GetByTitle($listName)
 $contentTypes=$list.ContentTypes
 $contentType=$contentTypes[0]
 $context.load($contentType)
 $context.ExecuteQuery()
 $contentType.NewFormUrl="/TestList2/NewForm.aspx"
 $contentType.update($false)
 $context.ExecuteQuery()
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.