Skip to main content

Notifications

Announcements

No record found.

Microsoft Dynamics AX (Archived)

Can we edit a field on a form if its allow edit property is "No" on the data source table of that field using code.

(0) ShareShare
ReportReport
Posted on by 502

Hello all,

Can we edit a field on a form if its allow edit property is "No" on the data source table of that field using code.

Thank You

Siddhant 

*This post is locked for comments

  • Suggested answer
    nmaenpaa Profile Picture
    nmaenpaa 101,156 on at
    RE: Can we edit a field on a form if its allow edit property is "No" on the data source table of that field using code.

    Ok, then just set AllowEdit:Yes on the form level and change AllowEdit of those fields based on your criteria.

    Please note that it's not enough to call your logic in the modified method of the field. You also need to call it in the active method of the data source. This way the logic is run every time the user selects another sales order.

  • Siddhant Singh Profile Picture
    Siddhant Singh 502 on at
    RE: Can we edit a field on a form if its allow edit property is "No" on the data source table of that field using code.

    Hi Nikolaos,

    AllowEdit:No is on Form Level.

    I have written this code on Data Source level.

    and then called it on modified method of the field.

    public void enableFields()

    {

       SalesTable_ds.object(fieldNum(SalesTable, ShippingDateRequested)).enabled(bfpSalesType.Field);

       SalesTable_ds.object(fieldNum(SalesTable, ReceiptDateRequested)).enabled(bfpSalesType.Field);

    }

  • Suggested answer
    nmaenpaa Profile Picture
    nmaenpaa 101,156 on at
    RE: Can we edit a field on a form if its allow edit property is "No" on the data source table of that field using code.

    If the original AllowEdit:No in the table fields is something you have done, why not just remove that change and allow user to edit those fields. Then on form level you can set AllowEdit to No if your condition is not met.

    If that's not feasible you have to use an edit method, or a dialog to let the user change the value.

  • Siddhant Singh Profile Picture
    Siddhant Singh 502 on at
    RE: Can we edit a field on a form if its allow edit property is "No" on the data source table of that field using code.

    Hi Andre,

    Previously forced to “No” the property “AllowEdit” of both ShippingDateRequested and ReceiptDateRequested of SalesTable datasource on SalesTable form.

    We are now asked to let the user modify those data if bfpSalesType.field is activated for the sales type of the specific order then user can modify those 2 dates.

  • André Arnaud de Calavon Profile Picture
    André Arnaud de Cal... 291,391 Super User 2024 Season 2 on at
    RE: Can we edit a field on a form if its allow edit property is "No" on the data source table of that field using code.

    Hi Siddhant,

    Can you explain your scenario? Possibly an edit method on the form would be an easy solution.

  • Suggested answer
    Khurshid Wali Profile Picture
    Khurshid Wali 922 on at
    RE: Can we edit a field on a form if its allow edit property is "No" on the data source table of that field using code.

    Hi Siddhant Singh,

    Yes, we can change the Value using X++ method. but we have to refresh the form to update its value on form.

    regards,

    Khurshid wali

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

December Spotlight Star - Muhammad Affan

Congratulations to a top community star!

Top 10 leaders for November!

Congratulations to our November super stars!

Tips for Writing Effective Verified Answers

Best practices for providing successful forum answers ✍️

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 291,391 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 230,445 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans