web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Small and medium business | Business Central, N...
Answered

disable custom button with action trigger on mulitple select

(3) ShareShare
ReportReport
Posted on by 179
I understand that in Business Central, custom action buttons can be disabled automatically when multiple records are selected on a list page if action button does not have  OnAction trigger.
But how can a custom action button that includes an OnAction trigger be disabled.

For context, I need to run code from the action button 'test action' for a selected record, but I want the button to be disabled when multiple records are selected.
 
 
 
 
thanks
 
 
 
 
 
I have the same question (0)
  • Suggested answer
    Pallavi Phade Profile Picture
    5,714 Super User 2026 Season 1 on at
     
    Can you do below things and verify . We usually do this to make action visible and to execute script.
     
    1) Remove Page-Link and add necessary filters to table and run the action
    2) Add below Properties 
    3) Add script in Trigger - OnAction() . I used xmlport , you can use your object 

     
    IF you feel this helped , Mark as "Verified"
     
    Regards
    Pallavi Phade
  • Verified answer
    Rishabh Kanaskar Profile Picture
    6,231 Super User 2026 Season 1 on at
    Hi,
     
    Business Central does not automatically disable actions with OnAction when multiple records are selected. You must handle it manually.
    Solution: Use the OnAfterGetCurrRecord trigger (or OnOpenPage) to check if multiple records are selected and control the Enabled property via a Boolean variable.
    Example:
    pageextension 50100 CustomerListExt extends "Customer List"
    {
        actions
        {
            addlast(Processing)
            {
                action(MyAction)
                {
                    Caption = 'My Action';
                    Enabled = EnableMyAction;
                    trigger OnAction()
                    begin
                        // Your logic here
                    end;
                }
            }
        }
        var
            EnableMyAction: Boolean;
        trigger OnAfterGetCurrRecord()
        var
            SelectedRecs: Record Customer;
        begin
            CurrPage.SetSelectionFilter(SelectedRecs);
            EnableMyAction := SelectedRecs.Count = 1;
        end;
    }
     
    This disables the button when more than one record is selected.
     
    Thanks
    Rishabh
  • Suggested answer
    RockwithNav Profile Picture
    9,158 Super User 2026 Season 1 on at
    Why not to give an error message when multiple records are selected, instead of hiding it.
  • Suggested answer
    Sumit Singh Profile Picture
    11,797 Super User 2026 Season 1 on at
    Hi Ahsan,
     
    Use a Boolean bound to Enabled and recompute it from the current selection.
    CurrPage.SetSelectionFilter gives you the selected rows; disable the action unless exactly one row is selected.

    This keeps the button disabled when multiple records are selected, while still running your OnAction code for a single selection.

    Please mark “Verified” if it helps.
  • Suggested answer
    Nimsara Jayathilaka. Profile Picture
    5,128 Super User 2026 Season 1 on at
    HI
     
    Reffer For Full Overview : https://yzhums.com/63922/
     
    Thanks
    Nimsara

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

Season of Sharing Community Challenge Launch!

Jump in, show your community spirit, and win prizes!

Women in Power Builds Momentum

Expanding mentorship, skilling, and AI innovation

Congratulations to the April Top 10 Community Leaders

These are the community rock stars!

Leaderboard > Small and medium business | Business Central, NAV, RMS

#1
OussamaSabbouh Profile Picture

OussamaSabbouh 2,466 Super User 2026 Season 1

#2
YUN ZHU Profile Picture

YUN ZHU 1,829 Super User 2026 Season 1

#3
AndrewThomas81 Profile Picture

AndrewThomas81 1,505

Last 30 days Overall leaderboard

Featured topics

Microsoft Training Manuals

Product updates

Dynamics 365 release plans