Skip to main content

Notifications

Announcements

No record found.

Microsoft Dynamics 365 | Integration, Dataverse...
Answered

How to show an alert message when the maximum text limit of a field reaches

Posted on by 1,017

Hi, we have a requirement to show an alert message when use enters the maximum length of the field that it is set to.

We have a multiple lines of text field and its limit we have currently set to is 5000 characters and when users reaches 5000 characters, I want to show an alert message. Please advise how can this be achieved.Thanks.

  • Verified answer
    Steve Zhao2 Profile Picture
    Steve Zhao2 on at
    RE: How to show an alert message when the maximum text limit of a field reaches

    Hi James,

    You could change the control of multiple lines of text field, such as change it to Rich Text Editor Control.

    pastedimage1668134407572v1.png

    And if users reach 5000 characters, it will automatically alert this error message:

    pastedimage1668134620317v2.png

  • Verified answer
    Bipin D365 Profile Picture
    Bipin D365 28,964 Super User 2024 Season 1 on at
    RE: How to show an alert message when the maximum text limit of a field reaches

    Hi,

    Try below code

    function AlertWhenLengthExceeded(executionContext)

    {

    Var formContext= executioncontext.getFormContext();

    Var value = formContext.getAttribute("yourfieldschemanane").getValue();

    if(value.length>500)

    alert("your message");

    }

    Add this function on onchange of your field

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

December Spotlight Star - Muhammad Affan

Congratulations to a top community star!

Top 10 leaders for November!

Congratulations to our November super stars!

Tips for Writing Effective Suggested Answers

Best practices for providing successful forum answers ✍️

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 291,280 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 230,214 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Product updates

Dynamics 365 release plans