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

Community site session details

Session Id :
Microsoft Dynamics AX (Archived)

Form read only mode - depending on the selected record

(0) ShareShare
ReportReport
Posted on by 1,650

[AX2012]

Hello,

I've got a very basic question. How can I set a form into read-only mode depending on a value of the selected record.

I tried to set the "DataSource_DS.allowEdit(false)" in the active method, but if you switch the mode via the standard button "edit" (Ctrl + Shift + E) the allowEdit(false) is disabled and the user can edit the datasource.

Is there a way to prevent the user to enter the "edit mode" (by using the buttons "edit" or the Shortcut) depending on a value of the selected record?

Any help would be appreciated.

Sebastian

*This post is locked for comments

I have the same question (0)
  • Sebastian Aurand Profile Picture
    1,650 on at
    Re: Form read only mode - depending on the selected record

    Thanks David for the response.

    I will check out on this as soon as there is time and give a feedback here.

  • Verified answer
    David Kidder Profile Picture
    on at
    Re: Form read only mode - depending on the selected record

    Looks like the form method setDSAccess is called in both the Active method of the SMAServiceOrderTable DataSource AND the SMAServiceOrderLine DataSource.

    So if you change the allowEdit only in SMAServiceOrderTable's active method it will just be overwritten when the SMAServiceOrderLine datasource's Active method fires.

    I would suggest updating the code in setDSAccess method to fit your requirements.

  • Sebastian Aurand Profile Picture
    1,650 on at
    Re: Form read only mode - depending on the selected record

    Thanks for the fast response.

    Yes, I'm adapting a standard form "SMAServiceOrderTable".

    In the first place the behaviour of the form is correct, but if I press the "Edit" Button, the "allowEdit(false)" is released.

    Is there another possibility the stepping through the code and identifying the statement, which is reenabling the datasource?

    Which methods are crossed when hitting the "Edit" Button?

    Thansk in advance

    Sebastian

  • Suggested answer
    Don Price Profile Picture
    30 on at
    Re: Form read only mode - depending on the selected record

    I just tried in Custtable and it works okay. Add to CustTable_ds.allowEdit(false) to last line in active.  I assume you are editing a standard form? If so, make sure you step the code to make sure something else is not setting after you do. You could also try to make sure you're last in line in the active.

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…

Abhilash Warrier – Community Spotlight

We are honored to recognize Abhilash Warrier as our Community Spotlight honoree for…

Leaderboard > 🔒一 Microsoft Dynamics AX (Archived)

#1
Community Member Profile Picture

Community Member 4

#2
Guy Terry Profile Picture

Guy Terry 2 Moderator

#2
Nayyar Siddiqi Profile Picture

Nayyar Siddiqi 2

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans