Skip to main content

Notifications

Announcements

No record found.

Microsoft Dynamics 365 | Integration, Dataverse...
Suggested answer

Making a Record read-only based on a field value

Posted on by 445

Hi,

I am just wondering, how is it possible to make a record read only based on a field value in the record? Is it a Field Security setting or a User permissions setting?

Basically, I have created a new Custom entity for a database I have built of staff. I have created one field which has 3 values that can be selected in a traffic light type system. So the values are Green, Orange and Red.

I would like to make the record read-only if the values in the field are either Red or Amber.

Thanks a lot as always

Ted

  • Suggested answer
    Community Member Profile Picture
    Community Member Microsoft Employee on at
    RE: Making a Record read-only based on a field value

    If you do this JavaScript approach, make sure to do OnLoad as well, or else they could potentially come back into the record and the field be unlocked.

  • Suggested answer
    RE: Making a Record read-only based on a field value

    Hi Ted,

    This should be easily achievable using a simple script on that form.

    The flow should be:

    - create the javascript file and register it on the form

    - register the function on the OnChange event of the field with Green, Orange and Red values (when it changes, run the script)

    - in the script, check if the value is "Red" for example

    - if yes, set another field on the form as Read Only

    How to get the value of a field on a form: docs.microsoft.com/.../getvalue

    And with this function, you can set the field as read only (disabled): docs.microsoft.com/.../setdisabled

    Hope this helps!

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,253 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 230,188 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Product updates

Dynamics 365 release plans