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

john john 941 Reputation points
2021-04-01T20:33:50.587+00:00

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?

SharePoint
SharePoint
A group of Microsoft Products and technologies used for sharing and managing content, knowledge, and applications.
9,624 questions
0 comments No comments
{count} votes

Accepted answer
  1. MichaelHan-MSFT 18,016 Reputation points
    2021-04-02T02:37:51.387+00:00

    Hello, @john john ,

    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.


1 additional answer

Sort by: Most helpful
  1. MichaelHan-MSFT 18,016 Reputation points
    2021-04-02T08:56:08.247+00:00

    Hi @john john ,

    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()  
    
    1 person found this answer helpful.
    0 comments No comments