Converting a DropDown Field to a TextField

    Overview

    As part of configuring Sugar® to match your business process, you may initially create various dropdown fields. As time goes by, you may need to add more values to your dropdown lists to keep up with the growth and change in your business. Before you know it, a dropdown field may not seem like the best solution as you need more customizable and general values. To better suit your needs, you may decide to convert this dropdown field into a text field. This article covers how to move an existing dropdown field’s value to a new text field using Sugar’s import tool.

    Use Case

    In this example, we will move the values from the “Custom Field 1” dropdown field to a new text field (e.g. New Text Field) in the Accounts module.

    Prerequisite

    You should have existing records with a dropdown field that has values. You must be familiar with creating new fields and editing layouts in Studio. For more information on creating fields, please refer to the Studio documentation. 

    Steps to Complete

    Currently, data types cannot be changed for existing fields in Sugar. The ability to do so is an existing enhancement request.

    In order to manually convert a dropdown field to a text field, please follow the steps in the sections below:

    Creating a Report

    First, we will create a Rows and Columns-type report to export the existing dropdown values for your records. Use the following steps to create the report: 

    1. Navigate to the Reports module and select “Create Report”.
    2. Choose “Rows and Columns” as the report type and “Accounts” as the target module.
    3. On the Define Filters step, choose your dropdown field from the Available Fields panel. For this example, we will select “Custom Field 1” as our dropdown field.
    4. Choose “Is Not Empty” to include all records with a value in this field. Click “Next”.
      rest/v10/supp_Files/18ddc963-b931-1b70-b806-55027f1053f1/file/uploadfile?format=sugar-html-json&platform=base
    5. On the Choose Display Columns step, select “ID”, “Custom Field 1”, and any required fields such as “Name” for the Accounts module. Click “Next”.
      Image_3Rev
    6. Enter a name for the report and click “Save and Run”.
    7. Choose “Export” from the Actions dropdown menu to create a .CSV (spreadsheet) file of your data.
      Report - Export
    8. Save the exported .CSV file to your computer.

    Creating a New Text Field

    Next, we will create a new text field where the existing values from the dropdown fields will be mapped. Use the following steps to create the new text field via Admin > Studio:

    1. Navigate to Admin > Studio > Accounts > Fields and click “Add Field”.
    2. Select “TextField” as the Data Type then enter the field name (e.g. New Text Field). Click “Save”.
      Studio NewTextField Save
    3. Place the new text field in each layout where the existing dropdown field appears (e.g. Record View, EditView, Detailview, and List View).

    Importing the Data

    Now we will import the .CSV file from your report and map the values from the dropdown field to the new text field. For more information on updating records via import, please refer to the Updating Records Via Import article. Use the following steps to import the .CSV file to update the text field: 

    1. Click the triangle in the Accounts module tab and select “Import Accounts” from the actions menu.
      Accounts - Import
    2. On Step 1, click the Choose File button and locate your .CSV file. Then choose “Create new records and update existing records”. Click “Next”.
    3. In Step 2, confirm that the file is being read correctly and click “Next”.
    4. In Step 3, map the necessary fields. Since we are moving the existing dropdown values to the text field, map “Custom Field 1” to “New Text Field” in the Module Field column. Click “Next”.
      Import Step3 Map CustomField1
    5. In Step 4, you do not need to check for possible duplicates since you are updating existing records. Click “Import Now”.
    6. Once the import completes, the View Import Results summary will display a successful message and the total number of updated records.

    Confirming the Data

    Now that the account records have been updated successfully, navigate to the Accounts module and confirm that the imported data appears as expected. Use the following steps to verify that the dropdown values carried over to the text field: 

    1. Navigate to the Accounts list view by clicking the module tab.
    2. Verify that the appropriate values carried over from “Custom Field 1” to “New Text Field”.
      AccountsListView NewTextField
    3. Check the account’s record view as well to confirm that the appropriate value shows up in your new text field.
      AccountsRecordView NewTextField

    Cleaning Up

    Use the following steps to remove the old dropdown field from the Accounts module:

    1. Navigate to Admin > Studio > Accounts > Fields.
    2. Select “Custom Field 1” from the fields list then click the Delete button to remove the field.
      rest/v10/supp_Files/2e00bb00-d862-e267-8b20-5502807418ca/file/uploadfile?format=sugar-html-json&platform=base

    Note: If the dropdown is a stock field that cannot be deleted, please remove it from the appropriate layouts (e.g. Record View, EditView, DetailView, and List View) so that it will no longer be seen or used.

    Application

    Now that the drop down field has been converted successfully, you can use the new text field to input unrestricted values moving forward.

    in Studio and Module Builder

    Reach out to us for help