Skip to main content

Notifications

Announcements

No record found.

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

Disable an Action in Role Center

(1) ShareShare
ReportReport
Posted on by 27

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
  • Suggested answer
    YUN ZHU Profile Picture
    YUN ZHU 74,115 Super User 2024 Season 2 on at
    Disable an Action in Role Center
    As far as I know this cannot be done, the easiest way to think about it is to copy another Role Center and hide this button on it.
     
    Thanks
    ZHU
  • Prajakta Raut Profile Picture
    Prajakta Raut 18 on at
    Disable an Action in Role Center
    Hi,
     
    If you found a solution for this issue, please revert the solution. I am facing the same issue.
     
    Thank you in advance!
  • 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 27 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 27 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!

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