Skip to main content
Community site session details

Community site session details

Session Id :
Dynamics 365 Community / Forums / Finance forum / Sales lines security
Finance forum
Unanswered

Sales lines security

(1) ShareShare
ReportReport
Posted on by
Hi,

I have added a NoYes field called 'Field1' to SalesLine. Whenever i select some lines and click a button, this 'Field1' field is updated to yes for those selected lines.
Now if 'Field1' field value is yes, the line should not be editable by anyone. Only sys admin can edit the line. How to do that?

is this a good solution?

maybe on active method of salesLine:

if(Global::isSystemAdministrator() && this.Field1== NoYes::Yes)
{
   this.allowEdit(False);
}
  • André Arnaud de Calavon Profile Picture
    296,161 Super User 2025 Season 1 on at
    Sales lines security
    Hi,
     
    Yes, the behavior as you see on the grid is as per design. It can only update columns, not individual cells.
     
    On the table and data entity, you can add coding on the validateWrite method. 
  • André Arnaud de Calavon Profile Picture
    296,161 Super User 2025 Season 1 on at
    Sales lines security
    Hi,
     
    When adding the code as you suggested, this will work on the form only. In case data is to be updated using integrations, you can add validations on the table and/or data entity. That will add an additional level of security. 

    Personally, I would not rely on the system administrator to be able to update the field, but have a business person having a non system admin role being able to make updates. What is the business reason for blocking the line and have a system administrator involved in case an update is required? 
     
    A security policy will be a bit harder here. It will then already check in case the Locked field will be enabled. It will not check anymore in case a user will disable the Locked field.
     
     
     
     
  • Anton Venter Profile Picture
    20,138 Super User 2025 Season 1 on at
    Sales lines security
    Hello,
     
    Your solution seems fine to me, I don't how you will be able to do the same with security though. When are the lines locked?
  • Waed Ayyad Profile Picture
    8,683 Super User 2025 Season 1 on at
    Secuirty
    Hi,
     
    Does locked filed be editable from the form? if yes then you should add the same code to the modified field of the Locked field, you can create new method on the DataSource and call it in all places you want.
     
     
    Thanks,
    Waed Ayyad
    If this helped, please mark it as "Verified" for others facing the same issue
     

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

News and Announcements

Now Available: 2025 Release Wave 2

Quick Links

November Spotlight Star - Khushbu Rajvi

Congratulations to a top community star!

Forum Structure Changes Coming on 11/8!

In our never-ending quest to help the Dynamics 365 Community members get answers faster …

Dynamics 365 Community Platform update – Oct 28

Welcome to the next edition of the Community Platform Update. This is a status …

Leaderboard > Finance

Featured topics

Product updates

Dynamics 365 release plans