Skip to main content

Notifications

Announcements

No record found.

Microsoft Dynamics AX forum
Answered

How to Disable Edit button on SalesTableListPage and SalesTable DetailsPage based on Customer Group ax 2012?

Posted on by 1,811

Hii,

On SalesTableListPage and SalesTable DetailsPage we need to disable Edit Button if Customer belongs to Cash Customer Group (Customer Group name is Cash).

For all other Customers Groups Edit button should work as normal.

How I can achieve it and code examples?

Thanks,

  • Verified answer
    Gunjan Bhattachayya Profile Picture
    Gunjan Bhattachayya 35,417 on at
    RE: How to Disable Edit button on SalesTableListPage and SalesTable DetailsPage based on Customer Group ax 2012?

    Hi Rana Anees,

    For SalesTableListPage, you can modify setButtonSell method in SalesTableListPageInteraction class. You can set the variable "allowUpdate" in this method to false if the customer group name is "Cash".

    private void setButtonSell()
    {
        SalesTableType      salesTableType = this.currentSalesTable().type();
        boolean             allowDelete = salesTableType.checkDelete(true, true);//We cannot show any dialogs from the list page as is also renders on EP.
        boolean             allowUpdate = salesTableType.checkUpdate(false, false);
        FormDataSource      salesTable_ds;
    
        // Changes for disabling edit for sales orders    
        if (CustGroup::find(this.currentSalesTable().CustGroup).Name == "Cash")
        {
            allowUpdate = false;
        }
        
        // Rest of the code
    }

    For SalesTable form, you can put this logic in the SalesTable dataource active method. you can set the datasource allowEdit to false.

    if (CustGroup::find(salesTable.CustGroup).Name == "Cash")
    {
        salesTable_ds.allowEditfalse;
    }

Helpful resources

Quick Links

Replay now available! Dynamics 365 Community Call (CRM Edition)

Catch up on the first D365 Community Call held on 7/10

Community Spotlight of the Month

Kudos to Saurav Dhyani!

Congratulations to the June Top 10 community leaders!

These stars go above and beyond . . .

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 287,773 Super User

#2
Martin Dráb Profile Picture

Martin Dráb 225,513 Super User

#3
nmaenpaa Profile Picture

nmaenpaa 101,148

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans