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

Announcements

No record found.

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 165
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,420 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,219 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
    8,959 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,757 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
    4,950 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

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Stars!

Meet the Microsoft Dynamics 365 Contact Center Champions

We are thrilled to have these Champions in our Community!

Congratulations to the March 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,005 Super User 2026 Season 1

#2
YUN ZHU Profile Picture

YUN ZHU 1,148 Super User 2026 Season 1

#3
Khushbu Rajvi. Profile Picture

Khushbu Rajvi. 557 Super User 2026 Season 1

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans