How to Rename a Field in Content Type

Environment

Service Data (Backend Services)

Description

You want to rename an existing field in a content type. The rename option is not available in Telerik Platform UI.

Solution

Each item in a content type consists of field-value pairs ({Field-Name: Field-Value}). When you want to rename the field name you need to update all items in the database ("Field-Name" with "New-Field-Name").

As this is an update database operation, updating the field names will also amend the following system fields:

  • "ModifiedAt" value will be updated with current date for all renamed items
  • "ModifiedBy" value will be set to an empty Guid like "00000000-0000-0000-0000-000000000000" for all renamed items

To rename a field you have to complete the following steps:

  1. Update the field name in the database - you can use '$rename' operator and issue a PUT request:

    Request:
        PUT https://api.everlive.com/v1/your-app-id/content-type-name
    Headers:
        Authorization  masterkey  your-master-key
        Content-Type application/json
    Data:
        {
            "$rename": {"old-field-name": "new-field-name" }
        }
    
  2. Update the name of the column as shown in the Data Browser

    • Delete the field with the old name from Telerik Platform -> Data -> Types -> Edit Structure (this will have no effect over the data).
    • Create a new field with the new name that matches the "new-field-name" from Step 1. The new field will correctly bind to the renamed keys in the stored data in Step 1 and will be displayed properly in the UI - Data Browser.
Start a free trial Request a demo
Contact us: +1-888-365-2779
sales@telerik.com
Copyright © 2016-2017, Progress Software Corporation and/or its subsidiaries or affiliates. All Rights Reserved.