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 :
Finance | Project Operations, Human Resources, ...
Suggested Answer

How to enable/disable button based on sales line selection in sales order form.

(1) ShareShare
ReportReport
Posted on by 230
Hi Team,
 
Sales and Marketing -> Sales Orders -> All sales orders -> Sales table details
 
In sales order line action pane name LinesActionPaneStrip i have added custom button.
 
I have to enable/disable a button based on status of selected line.
 
To achieve this i have wrote code in form data source sales line selectionChanged method.
 
selectionChanged() also calling while open the open and while save the records in form.
 
My requirement is i have to enable/disable button based on selected line and method should call only if line has been selected from sales order line. 
 
 
 
Categories:
I have the same question (0)
  • Suggested answer
    Martin Dráb Profile Picture
    239,036 Most Valuable Professional on at
    selectionChanged() isn't the right method - use active() instead. 
  • Andrey Zhuchhkov Profile Picture
    14 on at
    You can try to create a new extension for the "SalesLine" data source as follows:
     
    [ExtensionOf(formDataSourceStr(SalesTable, SalesLine))]
    final class SalesTableFormDSSalesLine_Extension
    {
       int active()
       {
           //get the current record
           SalesLine salesLine = this.cursor();
    
           int ret = next active();
    
           this.formRun().design().controlName(formControlStr(SalesTable, "Button")).enabled("Your condition");
    
           return ret;
       }
    
    }​​​​​​​
  • Martin Dráb Profile Picture
    239,036 Most Valuable Professional on at
    Note that you can refer to form variables through the element variable (e.g. element.Button).

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 > Finance | Project Operations, Human Resources, AX, GP, SL

#1
Giorgio Bonacorsi Profile Picture

Giorgio Bonacorsi 658

#2
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 468 Super User 2026 Season 1

#3
Syed Haris Shah Profile Picture

Syed Haris Shah 333 Super User 2026 Season 1

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans