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

Notifications

Announcements

Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / Block edit of record f...
Power Apps
Unanswered

Block edit of record from specific user model-driven app

(0) ShareShare
ReportReport
Posted on by 59

Hello everyone,

 

I’m working in a model-driven app for the performance evaluation in my organization. I created a table with the evaluations that must be completed. There are two user related fields in the table, the “evaluated” and “evaluator” fields. Also, I have two different views, one for the evaluator to see all pending evaluations and the other for the evaluated to see already completed evaluations of himself. Those views ere filtered eighter by the “evaluated” and “evaluator” field equal to current user to display the appropriate information. However, I have a problem in the view of already completed evaluations. If the user double-click on the record, he will be redirected to the evaluation form and he is able to edit the record.

I want to forbid this behavior; I want to have a view for the completed evaluations that if any record is doubled-clicked nothing happens.

I’m open to any alternative of a view-only table that can be embedded in the model-driven app. Any help would be appreciated.

Also, I’m not a JS programmer in case any solution involves a custom script.

I have the same question (0)
  • Ram Prakash Duraisamy Profile Picture
    5,593 Super User 2025 Season 2 on at

    Hello @danielmbaquero,

     

    Correct me if am wrong, you are having a Field that will contact Evaluated or Evaluator

    if you open Evaluated Record it should be read only 

    if you open Evaluator Record it should be Editable 

     

    Am i correct?

     

    Please mark as Answer if it is helpful and provide Kudos


    Subscribe : https://www.youtube.com/channel/UCnGNN3hdlKBOr6PXotskNLA
    Blog : https://microsoftcrmtechie.blogspot.com

  • danielmbaquero Profile Picture
    59 on at

    Hello @rampprakash,

     

    My table have two user fields, one for the evaluated and one for the evaluator.

    If the user in the evaluator field opens the record it should be editable.

    If the user in the evaluated field opens the record it should be read only.

    Hope that clarifies the problem.

  • Ram Prakash Duraisamy Profile Picture
    5,593 Super User 2025 Season 2 on at

    Hello @danielmbaquero,

     

    you can try below Script to achieve the same

     

    function enableDisableField(executionContext) {

    var formContext = executionContext.getFormContext();
    var EvaluatorID = "";
    var EvaluatedID = "";
    if (formContext.getAttribute("EVALUATORLOGICALNAME").getValue() != null) {
    EvaluatorID = formContext.getAttribute("EVALUATORLOGICALNAME").getValue()[0].id.toString().replace("{", "").replace("}", "");
    }

    if (formContext.getAttribute("EVALUATEDLOGICALNAME").getValue() != null) {
    EvaluatedID = formContext.getAttribute("EVALUATEDLOGICALNAME").getValue()[0].id.toString().replace("{", "").replace("}", "");
    }

    var getLoggedinUseriD = formContex.getUserId().replace("{", "").replace("}", "");

    if (EvaluatorID == getLoggedinUseriD || EvaluatorID == EvaluatedID) {
    formContext.ui.controls.forEach(function (control, i) {
    if (control && control.getDisabled && !control.getDisabled()) {
    control.setDisabled(false);
    }
    });
    }
    else {
    formContext.ui.controls.forEach(function (control, i) {
    if (control && control.getDisabled && !control.getDisabled()) {
    control.setDisabled(true);
    }
    });
    }
    }

     

    You can call this function in OnLoad of Form

     

    Please mark as Answer if it is helpful and provide Kudos


    Subscribe : https://www.youtube.com/channel/UCnGNN3hdlKBOr6PXotskNLA
    Blog : https://microsoftcrmtechie.blogspot.com

  • Verified answer
    Drew Poggemann Profile Picture
    9,287 Most Valuable Professional on at

    Hi @danielmbaquero ,

     

    I would do this through the security model within the Dataverse to control access.  

    1. First of all, utilize the Owner of the record to drive who "owns" the record.  Example is the Evaluator should be the owner of the record and this will allow them to view the records (by creating My Evaluations view for your table with the filter as them being owner) and you can have another field on the record as the user lookup for the Evaluator.  Again, using the owner will follow standard security model and you can use role based security to control access (https://docs.microsoft.com/en-us/power-platform/admin/wp-security-cds).  
    2. Create Access Team and then utilize this to dynamically allow the person being evaluated to access the record.  Access Teams provide the ability to control the user's access to the record so you can set this as "Read Only" and they will not be able to edit the record no matter how they go after it!  Good article on Access Teams (https://powerobjects.com/dynamics-365/using-access-teams-dynamics-365/
    3. Setup realtime workflow that you can execute maybe on a status change of the record to "Completed" or whatever and this would ad the person being evaluated on the record to the Access Team.
    4. Create a view for the person being reviewed that will allow them to view all records where they are part of the Access Team.  

    Overall this approach uses standard Model App and Dataverse capabilities with no custom code required.  The security is controlled through Microsoft's standard security model so users will not be able to inadvertently view records they do not have access to.

     

    Hope this helps.  Please accept if answers your question or Like if helps in any way.


    Thanks,

     

    Drew

  • danielmbaquero Profile Picture
    59 on at

    Hi @dpoggemann,

    Thank you for your recommendation. I deep dive into the control access and found a formula that did the trick. First, I used the owner field as the “Evaluator” user. Then, configured the security role of the basic user to edit at user level and view at an organization level. Also, configured the form to grant access for basic users.

  • Drew Poggemann Profile Picture
    9,287 Most Valuable Professional on at

    HI @danielmbaquero ,

     

    One quick thing on your current approach. If you set the "read" at the Organization level this means that every user will be able to read all of the evaluations.  Is this what you want or should the users only be able to view their own reviews and the ones they are completing for others?  Just wanted to check because thought it might be an issue.  This is why I suggested the Access Team as you can setup so users can only read their own reviews and of course edit the ones they are reviewers for...

     

    Thanks,


    Drew

  • danielmbaquero Profile Picture
    59 on at

    Hi @dpoggemann,

    Thank for your concern. I’m taking care of it with the filters of the view. There is an additional Boolean field to know if the evaluation is completed or not. The view filters are set up to show only records that are completed and the “evaluated” field is equal to the current user. In the tests that I performed everything is working as expected.

    For the evaluations that must be done, there is another view with the filters set up to display only records that are not completed yet and those whose owner is equal to current user.

     

    Kind Regards,

    Daniel M.

  • Drew Poggemann Profile Picture
    9,287 Most Valuable Professional on at

    Hi @rampprakash 

    Sounds good but just understand if you do not do through security there will be a back door they can get into this and view the information.  Example, is if they are in a model app and do an Advanced Find they will be able to view the records.  Other examples include connecting through Power BI, Odata Connector, upcoming Excel Connector, etc. to Dataverse

     

    Thanks,


    Drew

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

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 793 Most Valuable Professional

#2
Michael E. Gernaey Profile Picture

Michael E. Gernaey 333 Super User 2025 Season 2

#3
Power Platform 1919 Profile Picture

Power Platform 1919 268

Last 30 days Overall leaderboard