Skip to main content

Notifications

Finance | Project Operations, Human Resources, ...
Suggested answer

How to override an active method for button disabling in a form in x++

(0) ShareShare
ReportReport
Posted on by 70

Hi,

I have a condition to disable few buttons until a record is created in that form. In order words, when the selects the existing record or when the user creates a new record, the button should be visible or enable.

Consider the button names as open and close.

Thanks.

  • Komi Siabi Profile Picture
    Komi Siabi 12,759 Most Valuable Professional on at
    RE: How to override an active method for button disabling in a form in x++

    Hi C4u,

    Great, you got help from the forum.

    Please, do verify the replies that were helpful, by clicking Yes(Did this answer your question?)

  • C4u Profile Picture
    C4u 70 on at
    RE: How to override an active method for button disabling in a form in x++

    Thanks to everyone for supporting me to implement this.

    Regards,

    C4u

  • Suggested answer
    Mohit Rampal Profile Picture
    Mohit Rampal 12,552 Super User 2024 Season 1 on at
    RE: How to override an active method for button disabling in a form in x++

    You can check this article

    https://wp.me/pbtTY2-1c

  • Suggested answer
    GirishS Profile Picture
    GirishS 27,821 Super User 2024 Season 1 on at
    RE: How to override an active method for button disabling in a form in x++

    Refer to the below code.

    [ExtensionOf(formdatasourcestr(FornName, DataSourceName))] // Extension of Standard Obejct
    final class ClassName_Extension
    {
        public int Active()
        {
            int             ret;
            ret = next Active(); 
            TableName   tableName   =  element.tableName; 
            if(tableName)
            {
                buttonname.enabled(true);
            }
            else
            {
                buttonname.enabled(false);
            }
            return ret;
        }
    }

    Thanks,

    Girish S.

  • Suggested answer
    Bharani Preetham Peraka Profile Picture
    Bharani Preetham Pe... 3,587 Super User 2024 Season 1 on at
    RE: How to override an active method for button disabling in a form in x++

    If you want to write the extension of active, you need to write it as formdatasourcestr as the method is found at form datasource level. You cannot find this method at table level. You can simply follow the link which Girish shared.

  • C4u Profile Picture
    C4u 70 on at
    RE: How to override an active method for button disabling in a form in x++

    I am getting quite a lot of error. Whether this method can be written in a class where the first line is extensionof(tablestr("Specific data source name")). Can you provide me a sample code of lines for this active method ?.

  • GirishS Profile Picture
    GirishS 27,821 Super User 2024 Season 1 on at
    RE: How to override an active method for button disabling in a form in x++

    Hi,

    Refer to the below blog for using active method with COC.

    http://axaptaworld-saklani.blogspot.com/2021/01/d365-f-call-active-method-through.html

    Thanks,

    Girish S.

  • C4u Profile Picture
    C4u 70 on at
    RE: How to override an active method for button disabling in a form in x++

    This article shows the event handler right, can you provide inputs over coc ?

  • Suggested answer
    Mohit Rampal Profile Picture
    Mohit Rampal 12,552 Super User 2024 Season 1 on at
    RE: How to override an active method for button disabling in a form in x++

    If your requirement is on a custom form then you don't need CoC or event Handler as you can directly override those form methods. However, if it's a standard form then please check this article

    https://wp.me/p5srMU-dM

  • C4u Profile Picture
    C4u 70 on at
    RE: How to override an active method for button disabling in a form in x++

    Can you help me with the sample code for these 2 methods ?

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

Announcing Our 2025 Season 1 Super Users!

A new season of Super Users has arrived, and we are so grateful for the daily…

Announcing Forum Attachment Improvements!

We're excited to announce that attachments for replies in forums and improved…

Vahid Ghafarpour – Community Spotlight

We are excited to recognize Vahid Ghafarpour as our February 2025 Community…

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 291,965 Super User 2025 Season 1

#2
Martin Dráb Profile Picture

Martin Dráb 230,817 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Product updates

Dynamics 365 release plans