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

Notifications

Announcements

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 36
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,047 Super User 2025 Season 2 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

News and Announcements

Season of Giving Solutions is Here!

Quick Links

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

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

#1
Abhilash Warrier Profile Picture

Abhilash Warrier 732 Super User 2025 Season 2

#2
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 413 Super User 2025 Season 2

#3
Martin Dráb Profile Picture

Martin Dráb 289 Most Valuable Professional

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans