pnp / sp-dev-site-scripts

Repository for sample SharePoint site designs and site scripts

Home Page:https://docs.microsoft.com/en-us/sharepoint/dev/declarative-customization/site-design-overview

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

MultiChoice Field type doesn't provision properly

MarkStokes-outlook opened this issue · comments

Category

  • Question
  • Bug
  • Enhancement

Expected or Desired Behavior

I am trying to deploy a Multi-Choice Site Column with Fill-in choices enabled, add that to a Content Type, create a document library with that content type

Observed Behavior

The Site Column appears to be created, it appears to be added to the content type, but the content type cannot be added to the document library. If I try to manually add the Content Type to the Library then I get a "Sorry, something went wrong. Cannot complete this action. Please try again." error.

If I manually create a MultiChoice Site Column and add it to the Content Type through the UI then it works as expected and I can add the Content Type to the library.

I have also exported the Site Script for a manually created one and used that in my Site Script and it still fails.

Steps to Reproduce

Site Script:

{
    "$schema": "https://developer.microsoft.com/json-schemas/sp/site-design-script-actions.schema.json",
    "actions": [
        {
            "verb": "createSiteColumnXml",
            "schemaXml": "<Field Type=\"MultiChoice\" DisplayName=\"Product\" Group=\"CDMS\" Required=\"FALSE\" EnforceUniqueValues=\"FALSE\" Indexed=\"TRUE\" FillInChoice=\"TRUE\" ID=\"{9a90081c-a89a-4b3c-b041-8f51910a5762}\" StaticName=\"cdmsProduct\" Name=\"cdmsProduct\"><Default>Select...</Default><CHOICES><CHOICE>Select...</CHOICE></CHOICES></Field>"
        },
        {
            "verb": "createContentType",
            "name": "Controlled Document",
            "id": "0x010100E46A99072BB9B747AC570EEBC7D27E25",
            "description": "",
            "parentId": "0x0101",
            "hidden": false,
            "group": "CDMS - Level 1 Content Types",
            "subactions": [
                {
                    "verb": "addSiteColumn",
                    "internalName": "cdmsProduct"
                }
            ]
        },
        {
            "verb": "createSPList",
            "listName": "Administration",
            "templateType": 101,
            "subactions": [
                {
                    "verb": "addContentType",
                    "name": "Controlled Document"
                }
            ]
        }
    ],
    "bindata": { },
    "version": 1
}

Does anyone have an opinion on this? It is drastically affecting my Site Design.

I have a workaround which is to deploy a standard Choice field and then change its settings in the UI.

BUT, if we need to make changes and redeploy the site design then it gets set back to a Choice field and the multiple choices are lost (made into a single entry) breaking our data.

So, I have to deploy two site designs. One with the full set of content types and fields and another purely for updates which excludes the multiple choice fields and this is less than ideal as it confuses our users.