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 :
Dynamics 365 Community / Forums / Finance forum / Sales lines security
Finance forum
Unanswered

Sales lines security

(1) ShareShare
ReportReport
Posted on by 92
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);
}
I have the same question (0)
  • Waed Ayyad Profile Picture
    9,047 Super User 2025 Season 2 on at
    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
     
  • Anton Venter Profile Picture
    20,396 Super User 2025 Season 2 on at
    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?
  • André Arnaud de Calavon Profile Picture
    301,587 Super User 2025 Season 2 on at
    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.
     
     
     
     
  • André Arnaud de Calavon Profile Picture
    301,587 Super User 2025 Season 2 on at
    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. 

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

Season of Giving Solutions is Here!

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

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans