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

disabling menu item bassed on condition

(1) ShareShare
ReportReport
Posted on by 150
Hi,

I added a menu item on SalesLine grid in 'both salesTable' form and 'ProjSalesItemReq' form. Where these two forms have "SalesTable" and "SalesLine" as datasources

I want this menu item to be enabled only if SalesTable.SalesStatus = backOrder

is the only way to do it on active method for for salesLine datasource on both forms? just trying to see if there is another way than what i did, which will save calling the logic each time on active method for salesLine even though i'm checking SalesTable status
[ExtensionOf(formDataSourceStr(SalesTable, SalesLine))]
final class SalesTableSalesLineFormDS_Extension
{
    public int active()
 {
     int ret = next active();

     if(ret)
     {
         FormDataSource salesTableDataSource = element.dataSource(formDataSourceStr(SalesTable, SalesTable)) as FormDataSource;         
         SalesTable  salesTable  = salesTableDataSource.cursor();

         if(salesTableDataSource && salesTable && salesTable.SalesStatus == SalesStatus::Backorder)
         {
             element.design().controlName(formControlStr(SalesTable,XMenu)).enabled(true);
         }
         else
         {
             element.design().controlName(formControlStr(SalesTable,XMenu)).enabled(false);
         }
         
     }
     return ret;
 }
}
 
[ExtensionOf(formDataSourceStr(ProjSalesItemReq, SalesLine))]
final class ProjSalesItemReqFormDS_Extension
{
    public int active()
 {
     int ret = next active();

     if(ret)
     {
         FormDataSource salesTableDataSource = element.dataSource(formDataSourceStr(ProjSalesItemReq, SalesTable)) as FormDataSource;         
         SalesTable  salesTable  = salesTableDataSource.cursor();

         if(salesTableDataSource && salesTable && salesTable.SalesStatus == SalesStatus::Backorder)
         {
             element.design().controlName(formControlStr(ProjSalesItemReq,XMenu)).enabled(true);
         }
         else
         {
             element.design().controlName(formControlStr(ProjSalesItemReq,XMenu)).enabled(false);
         }
         
     }
     return ret;
 }
}
 
I have the same question (0)
  • Suggested answer
    Waed Ayyad Profile Picture
    9,061 Super User 2026 Season 1 on at
    Hi,
     
    Since your condition logic depends on SalesTable then I recommend you add it on the active and init method of SalesTable data source.
     
    Thanks,
    Waed Ayyad
    If this helped, please mark it as "Verified" for others facing the same issue
     

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!

Congratulations to our 2025 Community Spotlights

Thanks to all of our 2025 Community Spotlight stars!

Leaderboard > Finance | Project Operations, Human Resources, AX, GP, SL

#1
André Arnaud de Calavon Profile Picture

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

#2
Giorgio Bonacorsi Profile Picture

Giorgio Bonacorsi 402

#3
Diego Mancassola Profile Picture

Diego Mancassola 261

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans