web
You’re offline. This is a read only version of the page.
close
Skip to main content
Community site session details

Community site session details

Session Id :
Customer experience | Sales, Customer Insights,...
Suggested answer

Change single line of text to Integer Dynamically and bind to a grid

(0) ShareShare
ReportReport
Posted on by 20

Problem Statement:

In a subgrid list of possible values are being displayed, One of the column in grid only contains integer value but the type of the field is set as single line of text. Due to this, sorting of the grid is not working as per the requirements because it is string and not integer.

Possible Solution:

  • Create a new field.
  • Migrate the data to new field from old .
  • Delete the old field
  • Create another field with whole number.
  • Migrate data back to new field from previous created field

Wanted Solution:

Though, the solution above can work fine but it is very troublesome and could impact many things. Hence looking forward to a solution that could work dynamically or programmatically.

For example:

Using JavaScript if I can change the type dynamically and sort the values from greater to lesser value in the grid.

Looking for possible solutions and help

I have the same question (0)
  • Suggested answer
    Amit Katariya007 Profile Picture
    10,409 Super User 2025 Season 2 on at
    RE: Change single line of text to Integer Dynamically and bind to a grid

    Please once confirm how many records does have this field value. Because ideal solution will be to create a new field and paste the old field data to new one. Because in future if you want to use this field it will be less complicated.

    Thank you,

    Amit Katariya

  • Suggested answer
    Pradeep Rai Profile Picture
    5,489 Moderator on at
    RE: Change single line of text to Integer Dynamically and bind to a grid

    Hi,

    I would suggest go with creation of new field because it will be helpful long term like report etc.

    Other way is as abdul suggested to create new UI for same grid but adding all feature will become big task and time effort.

  • FaranSaleem91 Profile Picture
    20 on at
    RE: Change single line of text to Integer Dynamically and bind to a grid

    Dear Abdul Wahab,

    Thank you for your response. It seems it could work for me, but please could you show me an example of how I can convert an OOB grid to HTML and then convert the column to integer and bind it again at runtime?

  • Suggested answer
    Abdul Wahab Profile Picture
    12,119 Moderator on at
    RE: Change single line of text to Integer Dynamically and bind to a grid

    Hi FaranSaleem91,

    1. Convert this out-of-the-box grid to an HTML or build PCF control. Write the logic to convert the string to a number and bind data with the HTML or PCF Control
    2. Do not delete the existing column. Add (Deprecated) prefix with it. Once all dependencies are moved then delete.

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Abhilash Warrier – Community Spotlight

We are honored to recognize Abhilash Warrier as our Community Spotlight honoree for…

Leaderboard > Customer experience | Sales, Customer Insights, CRM

#1
Rishabh Kanaskar Profile Picture

Rishabh Kanaskar 258

#2
MVP-Daniyal Khaleel Profile Picture

MVP-Daniyal Khaleel 164

#3
Tom_Gioielli Profile Picture

Tom_Gioielli 121 Super User 2025 Season 2

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans