none
FieldType element for <choices> RRS feed

  • Question

  • I have a Farm Solution for a new Site Column of type Choice.

    I have successfully deployed the solution, and my new choice column is available in lists, etc.

    However my choices are not populating the dropdown list:

    

    My xml file looks like this, which is where I think the issue is. Anyone know what the element is to add choices?

    <?xml version="1.0" encoding="utf-8" ?>
    <FieldTypes>
      <FieldType>
        <Field Name="TypeName">RegionChoice</Field>
        <Field Name="ParentType">Choice</Field>
        <Field Name="TypeDisplayName">Regions Type</Field>
        <Field Name="TypeShortDescription">Regions</Field>
        <Field Name="Sortable">TRUE</Field>
        <Field Name="Filterable">TRUE</Field>
        <Field Name="UserCreatable">TRUE</Field>
        <Field Name="FillInChoice">FALSE</Field>
        <Field Name="Required">FALSE</Field>
      <CHOICES>
        <CHOICE>North</CHOICE>
        <CHOICE>South</CHOICE>
        <CHOICE>East</CHOICE>
        <CHOICE>West</CHOICE>
      </CHOICES>
        <Field Name="FieldTypeClass">RegionChoiceColumn.RegionChoice, $SharePoint.Project.AssemblyFullName$</Field>
      </FieldType>
    </FieldTypes>

    Friday, March 3, 2017 11:44 AM

Answers

  • Hi,

    In SharePoint 2013, please follow the steps below to create the Choice column.

    1. Create an empty SharePoint 2013 project and select the farm solution.

    2. Right click the project -> Add->New item...

    3. Select "Site Column" template and modify the name, then click "Add".

    4. Modify the Elements.xml as below:

    <?xml version="1.0" encoding="utf-8"?>
    <Elements xmlns="http://schemas.microsoft.com/sharepoint/">  
      <Field
           ID="{f70ff00e-57e1-4235-b3fc-8e67b32468dd}"
           Name="Pop"
           DisplayName="Pop"
           Type="Choice"
           Required="FALSE"
           Group="Custom Site Columns"
    	   Sortable="TRUE"
    	   Filterable="TRUE"
    	   FillInChoice="FALSE">
    	  <CHOICES>
    		  <CHOICE>North</CHOICE>
    		  <CHOICE>South</CHOICE>
    		  <CHOICE>East</CHOICE>
    		  <CHOICE>West</CHOICE>
    	  </CHOICES>	   
      </Field>
    </Elements>

    5. Deploy the solution and use it in your list.

    Best Regards,

    Dennis


    Please remember to mark the replies as answers if they help.
    If you have feedback for TechNet Subscriber Support, contact tnmff@microsoft.com

    • Marked as answer by Sonners Monday, March 6, 2017 2:19 PM
    Monday, March 6, 2017 8:12 AM
    Moderator

All replies

  • Can you please share your element manifest file?

    It should read something like the following. 

    <Field ID="{GUID}"
             Name="Regions"
             DisplayName="Regions Type"
             Type="Choice"
             Required="FALSE"
             Group="Custom Columns">
        <CHOICES>
          <CHOICE>North</CHOICE>
          <CHOICE>South</CHOICE>
          <CHOICE>East</CHOICE>
          <CHOICE>West</CHOICE>
        </CHOICES>
      </Field>


    Amit

    Friday, March 3, 2017 3:46 PM
  • The xml I quoted is it. That's the fldtype_<name>.xml file written to the HIVE.

    I'm not creating a feature that gets activated just deploying a new field type to the Farm. My method works, i just need to figure out how the xml definition file populates the dropdown list.

    Just for reference, this is the site that I started from:
    https://weblogs.asp.net/sreejukg/developing-custom-field-type-for-sharepoint-2010

    Your manifest file looks like it should be activated at Site Collection level.

    What GUID is it looking for?

     

    Friday, March 3, 2017 9:22 PM
  • Hi,

    In SharePoint 2013, please follow the steps below to create the Choice column.

    1. Create an empty SharePoint 2013 project and select the farm solution.

    2. Right click the project -> Add->New item...

    3. Select "Site Column" template and modify the name, then click "Add".

    4. Modify the Elements.xml as below:

    <?xml version="1.0" encoding="utf-8"?>
    <Elements xmlns="http://schemas.microsoft.com/sharepoint/">  
      <Field
           ID="{f70ff00e-57e1-4235-b3fc-8e67b32468dd}"
           Name="Pop"
           DisplayName="Pop"
           Type="Choice"
           Required="FALSE"
           Group="Custom Site Columns"
    	   Sortable="TRUE"
    	   Filterable="TRUE"
    	   FillInChoice="FALSE">
    	  <CHOICES>
    		  <CHOICE>North</CHOICE>
    		  <CHOICE>South</CHOICE>
    		  <CHOICE>East</CHOICE>
    		  <CHOICE>West</CHOICE>
    	  </CHOICES>	   
      </Field>
    </Elements>

    5. Deploy the solution and use it in your list.

    Best Regards,

    Dennis


    Please remember to mark the replies as answers if they help.
    If you have feedback for TechNet Subscriber Support, contact tnmff@microsoft.com

    • Marked as answer by Sonners Monday, March 6, 2017 2:19 PM
    Monday, March 6, 2017 8:12 AM
    Moderator
  • OK thanks. I get now that I have to create a Feature.

    I've followed all the steps above and can't get my Feature deployed or activated. So I guess that's for another question or maybe there is something wrong with my dev environment. :/

    Edit: I just realised that the feature is only being deployed/activated on the Central Admin site which is where I am deploying the solution.


    • Edited by Sonners Monday, March 6, 2017 2:25 PM
    Monday, March 6, 2017 2:19 PM
  • Check the feature scope and select the value based on your requirement. You can select Farm, Web Application, Site or Web scope.

    https://msdn.microsoft.com/en-us/library/office/ms436075.aspx


    Amit

    Tuesday, March 7, 2017 4:09 PM