Skip to main content

Notifications

Announcements

No record found.

Microsoft Dynamics CRM forum
Suggested answer

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

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

  • Suggested answer
    Amit Katariya007 Profile Picture
    Amit Katariya007 6,004 Moderator 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
    Pradeep Rai 5,490 Super User 2024 Season 2 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
    FaranSaleem91 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
    Abdul Wahab 12,070 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

Anton Venter – Community Spotlight

Kudos to our October Community Star of the month!

Announcing Our 2024 Season 2 Super Users!

A new season of Super Users has arrived, and we are so grateful for the daily…

Dynamics 365 Community Newsletter - September 2024

Check out the latest community news

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 290,554 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 228,588 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,148

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans