Skip to main content

Notifications

Small and medium business | Business Central, N...
Suggested answer

Disable an Action in Role Center

Posted on by 25

Hi Expert,

I Create a custom Role Center and in this Role Center i create  an Action 

this my Action 
action("Add")
            {
                ApplicationArea = All;
                Caption = 'Add';
                RunObject = Page "Customer";
                Enabled = ActionIsActivated();
                ToolTip = 'Specifies the value of Add action.';
            }
what i want is to control the value of enabled so i create a procedure 
 
 local procedure ActionIsActivated() : Boolean
    var
        lCashRegBoRoleCenter: Record "Cash Reg. B.O Role Center MMN";
        IsAtivated : Boolean;
    begin
        lCashRegBoRoleCenter.FindFirst();
        IsAtivated := lCashRegBoRoleCenter.IsActivated;
        exit(IsAtivated);
    end;
but the problem is always return false even if I emptied the procedure it return false
 local procedure ActionIsActivated() Boolean
   
    begin
   
    end;
if someone has a suggestion to solve this problem
Categories:
  • Suggested answer
    Govinda Kumar Profile Picture
    Govinda Kumar 2,203 Super User 2024 Season 1 on at
    RE: Disable an Action in Role Center

    Unfortunately, you cannot use variables or methods to control the visibility/enability of actions on Role Center page. If your requirement is essential, you may consider using AccessByPermission on your action property or using personalization or user permissions to see if it meets your requirements.

    Regards

  • Khadija  Profile Picture
    Khadija 25 on at
    RE: Disable an Action in Role Center

    this is the problem the triggers does not work in role center page, and that why i use a procedure but also does not work

  • Suggested answer
    Govinda Kumar Profile Picture
    Govinda Kumar 2,203 Super User 2024 Season 1 on at
    RE: Disable an Action in Role Center

    if you are unable to debug the procedure.. then it could mean that procedure is not returning any value even if you manually return 'true,' it will still be considered false.. so it might not be possible to achieve your goal using a method in Role Center page.

    One possible solution was to use a global variable and update its value according to your requirement... but again none of the triggers work on role center page.. so I don't think you can use any variable or method to update the enability of your action.. the only way you can do is by using direct value as true or false..

    Regards

  • Khadija  Profile Picture
    Khadija 25 on at
    RE: Disable an Action in Role Center

    I add this action in creation section

    for debugging i add an error message but it's not appearing.

    and there is no problem in the value of the first record

    even if the value of the first record is true the procedure return false

  • Suggested answer
    Govinda Kumar Profile Picture
    Govinda Kumar 2,203 Super User 2024 Season 1 on at
    RE: Disable an Action in Role Center

    Even after emptying the procedure returns false because the default value is false, you need to make sure that your code is being debugged and double-check the IsActivated value of your first record. By the way, which section of the role center page are you adding this action?

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!

Community AMA December 12th

Join us as we continue to demystify the Dynamics 365 Contact Center

New! Quick response templatesâš¡

Save time with the new custom templates!

Leaderboard

#1
André Arnaud de Calavon Profile Picture

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

#2
Martin Dráb Profile Picture

Martin Dráb 230,056 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans