Skip to main content

Notifications

Announcements

No record found.

Small and medium business | Business Central, N...
Answered

Prevent editing Purchase Order Page Card in AL code

(0) ShareShare
ReportReport
Posted on by 295

2 Users can create new Purchase Order.

How to prevent User A to edit Purchase Order created by User B using AL Code

User A can only view User B's PO.

  • Suggested answer
    Mohana Yadav Profile Picture
    Mohana Yadav 59,194 Super User 2024 Season 2 on at
    RE: Prevent editing Purchase Order Page Card in AL code

    Great. Keep learning and Thank you.

  • Hoang Ng Profile Picture
    Hoang Ng 295 on at
    RE: Prevent editing Purchase Order Page Card in AL code

    I found a code that lock Edit and Delete:

    CurrPage.Editable(false);

  • Verified answer
    Mohana Yadav Profile Picture
    Mohana Yadav 59,194 Super User 2024 Season 2 on at
    RE: Prevent editing Purchase Order Page Card in AL code

    You can throw error if other user is trying to modify the document as well using ERROR('You are not allowed to modify this document.');

  • Hoang Ng Profile Picture
    Hoang Ng 295 on at
    RE: Prevent editing Purchase Order Page Card in AL code

    Thanks Yadav,

    I will try your suggestion.

    Do you know which Action of Edit button ?

    I try to set Enabled= false for it.

    pastedimage1677578149915v1.png

  • Verified answer
    Mohana Yadav Profile Picture
    Mohana Yadav 59,194 Super User 2024 Season 2 on at
    RE: Prevent editing Purchase Order Page Card in AL code

    Please use OnBeforeModify trigger

  • Hoang Ng Profile Picture
    Hoang Ng 295 on at
    RE: Prevent editing Purchase Order Page Card in AL code

    Hi Yadav,

    I don't know what trigger or method should be used to lock editing the page so I have not written the code.

  • Suggested answer
    Mohana Yadav Profile Picture
    Mohana Yadav 59,194 Super User 2024 Season 2 on at
    RE: Prevent editing Purchase Order Page Card in AL code

    Did you try any code? what error are you facing?

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