Skip to main content

Notifications

Announcements

No record found.

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 163
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:
  • Martin Dráb Profile Picture
    Martin Dráb 230,432 Most Valuable Professional on at
    How to enable/disable button based on sales line selection in sales order form.
    Note that you can refer to form variables through the element variable (e.g. element.Button).
  • How to enable/disable button based on sales line selection in sales order form.
    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;
       }
    
    }​​​​​​​
  • Suggested answer
    Martin Dráb Profile Picture
    Martin Dráb 230,432 Most Valuable Professional on at
    How to enable/disable button based on sales line selection in sales order form.
    selectionChanged() isn't the right method - use active() instead. 

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,387 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 230,432 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Product updates

Dynamics 365 release plans