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

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Finance | Project Operations, Human Resources, ...
Unanswered

Code to set allow edit to no

(1) ShareShare
ReportReport
Posted on by
Write a code to allow edit - no in d365fo
 
I have the same question (0)
  • Martin Dráb Profile Picture
    237,878 Most Valuable Professional on at
    Hi, I fixed the title of your thread and moved it to the correct forum.
     
    Now please tell us more about your situation, so we can give you the right solution. I understand it's about AllowEdit property, but it's not clear which object you have in mind (e.g. a form data source, a data source field, an unbound control, a dialog field...).
  • Community member Profile Picture
    2 on at
    To allow or prevent editing in Dynamics 365 Finance and Operations (D365FO), you can utilize form control methods to manage the editable property of specific fields. Here is an example of how you can achieve this in X++ code:
    public void modifiedField()
    {
        FormDataSource   fds = this.dataSource();
        FormDataSource   fdsTable = fds.cursor();
    
        // Set the allowEdit property to true or false as needed
        fdsTable.object(fieldNum(Table, Field)).allowEdit(!yourCondition);
    }
    
    Replace "Table" and "Field" with the appropriate table and field names that you want to control the editing for. Additionally, modify "yourCondition" with your specific condition that determines whether editing is allowed or not.
    Make sure to incorporate this code in the appropriate method within the form, such as the init method or the modifiedField method, depending on your specific requirements.
    This code allows you to control the edit permissions dynamically based on certain conditions or criteria that you define. Adjust the conditions as necessary to meet your specific use case in D365FO.

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

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

Leaderboard > Finance | Project Operations, Human Resources, AX, GP, SL

#1
Martin Dráb Profile Picture

Martin Dráb 646 Most Valuable Professional

#2
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 529 Super User 2025 Season 2

#3
Sohaib Cheema Profile Picture

Sohaib Cheema 285 User Group Leader

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans