Create GUID[] type fields

To learn more about the different steps to create a custom field, read the For developers: Create custom fields for product types article.

To create a sample custom field of the type, GUID[], perform the following:

  1. Register the database mapping for the new type in order to store the data of the field.
    1. Go to Administration > Settings > Advanced > Metadata > DatabaseMappings.
    2. Click the Create new button on the right panel.
    3. Enter the following field details:
      1. Name: Enter the name as CustomMultipleChoices.
      2. CLR type: Enter the CLR type as System.String[].
      3. Database length: Enter the maximum length of the database as 255.
      4. SQL specific type: Enter the SQL Server-specific data type as NVARCHAR.
      5. Data type: Enter the data type of the field as VARCHAR.
      6. Nullable: Enable the checkbox for the column to allow null values. 
    4. Save changes.

      NOTE: The above values are only indicative. You can change the values of the fields as required.

  2. Register the new custom field, and specify the control to be used to display its values:
    1. Go to Administration > Settings > Advanced > Custom Fields > FieldTypes.
    2. Click the Create new button on the right panel.
    3. Enter the following field details:
      1. Name: Enter the name as CustomMultipleChoices.
      2. Title: Enter the title as CustomMultipleChoices.
    4. Save changes.
    5. You will now see the newly added custom field. From the left panel tree view, click the Controls option under the custom field, CustomMultipleChoices.
    6. Click the Create new button on the right panel.
    7. Enter the following field details:
      1. FieldTypeOrPath: Enter the field type as Telerik.Sitefinity.Web.UI.Fields.ChoiceField.
      2. Title: Enter the title as ChoiceField.
      3. DesignerType: Enter the designer type as Telerik.Sitefinity.Web.UI.Fields.Designers.MultipleChoiceFieldDesigner.
      4. ResourceClassId: Enter the resource class ID as ModuleEditorResources.
    8. Save changes.
  3. Next, add the newly created field where you want to use it (for example, in the user's profile).
    1. From the main dashoboard, use the main menu item to go to Administration > Users.
    2. In the Users page, click on the link, Manage Profile Types on the right panel.
    3. In the Profile types page that appears, click on the profile type, Basic profile.
    4. In the Basic profile page that appears, click the Add a field button in the Custom Fields section. 
    5. Enter the following field details:
    6. Save changes.
  4. You must now register the newly created custom field where you want it to be used (for example, in backend edit view of the users, and other views). The example below is for the Edit Screen of the user.
    1. Go to Administration > Settings > Advanced > ContentView > Controls > ProfileType_SitefinityProfile > Views > ViewBackendEdit > Sections > CustomFieldsSection > Fields > IsProfilePublic.
    2. In the right panel, edit the following:
      1. RenderChoicesAs: CheckBoxes: This is set to SingleCheckbox by default.
      2. ReturnValuesAlwaysInArray: Enable to checkbox to set this to True.
    3. Go to ChoicesConfig subelement and change/add/remove the elements you want to be available as choices for the field. (You can specify resources if you prefer).
    4. Save changes.

Increase your Sitefinity skills by signing up for our free trainings. Get Sitefinity-certified at Progress Education Community to boost your credentials.

Get started with Integration Hub | Sitefinity Cloud | Sitefinity SaaS

This free lesson teaches administrators, marketers, and other business professionals how to use the Integration hub service to create automated workflows between Sitefinity and other business systems.

Web Security for Sitefinity Administrators

This free lesson teaches administrators the basics about protecting yor Sitefinity instance and its sites from external threats. Configure HTTPS, SSL, allow lists for trusted sites, and cookie security, among others.

Foundations of Sitefinity ASP.NET Core Development

The free on-demand video course teaches developers how to use Sitefinity .NET Core and leverage its decoupled architecture and new way of coding against the platform.

Was this article helpful?