Skip to main content

Notifications

Announcements

No record found.

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

How to Control User for posting

(0) ShareShare
ReportReport
Posted on by 105

Hi all,

Hope you are all good, Still am learning day to day can please get an help, i want to to put control on user setup page like check box to allow a certain user to post some of documents in the system. Example to post item journal, or a certain user to block vendor 

Thank you all

  • Maro9595 Profile Picture
    Maro9595 105 on at
    RE: How to Control User for posting

    Thank you so much ZHU

  • Verified answer
    YUN ZHU Profile Picture
    YUN ZHU 76,095 Super User 2024 Season 2 on at
    RE: How to Control User for posting

    Hi,  change this line to Error('You do not have permision to Post')

    pastedimage1640222575597v1.png

  • Maro9595 Profile Picture
    Maro9595 105 on at
    RE: How to Control User for posting

    I have added a boolean field on User setup to allow or restrict the user from posting item journal, I have extended the item Journal page and added action.

    My problem is if a user is not allowed to post item journal in user setup only the pop-up message appears (Which shows that you don't have permission) but after saying ok, the posting process continues  I want to terminate the process completely if the user is not allowed to post

    bellow is my piece of codes please assist

    pageextension 50126 TestItmJ extends "Item Journal"

    {

       actions

       {

           modify(Post)

           {

               trigger OnBeforeAction()

               var

                   UserSetup: Record "User Setup";

               begin

                   if UserSetup.Get(UserId) then begin

                       if UserSetup."Post Item Journal" = false then

                           Message('You do not have permision to Post')

                       else

                           exit;

                   end;

               end;

           }

       }

    Thank you all

  • Maro9595 Profile Picture
    Maro9595 105 on at
    RE: How to Control User for posting

    Thank you so much ZHU

  • Verified answer
    YUN ZHU Profile Picture
    YUN ZHU 76,095 Super User 2024 Season 2 on at
    RE: How to Control User for posting

    Hi, you can add these control to User Setup page.

    pastedimage1638755270401v1.png

    This is a simple example: https://yzhums.com/15210/

    Hope this will help.

    Thanks.

    ZHU

  • Suggested answer
    Inge M. Bruvik Profile Picture
    Inge M. Bruvik 993 Super User 2024 Season 1 on at
    RE: How to Control User for posting

    These types of things should be done through the permission setup and my recommendation to you would be to try to avoid doing this in code.

    The permissions in BC can be defined down to each individual object. So if you want to control the execution of f.ex. the codeunit that post item journals you should do that through permission setup.

    You can defined permission sets that have permissions to specific objects and control what the users can do with the object.

    I would try to stick to the options available in the permission setup and not get involved in too much customization around this.

    The BC permission setup can be a little tricky to manage because you need some information around the object structure to fully understand it. But i think this is one of the areas that Microsoft will work on improving in coming versions. 

    Here is a link to some documentation that is a good starting point.

    docs.microsoft.com/.../ui-define-granular-permissions

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

Congratulations 2024 Spotlight Honorees

Kudos to all of our 2024 community stars! 🎉

Meet the Top 10 leaders for December

Congratulations to our December super stars! 🥳

Start Your Super User Journey Pt 2

Join the ranks of our community heros! 🦹

Leaderboard

#1
André Arnaud de Calavon Profile Picture

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

#2
Martin Dráb Profile Picture

Martin Dráb 230,540 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans