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.
You can do that by using chain of command
Write COC for both init and active methods. Init method when you open the form until selecting any record. Active, when record selected.
Hi, There is another thread for exactly same requirement. Probably you have duplicated it. If not, then please check this thread and follow the suggestions
community.dynamics.com/.../how-to-override-an-active-method-for-button-disabling-in-a-form-in-x
If still issues, please let us know.
Can you help me with the sample code for these 2 methods ?
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
This article shows the event handler right, can you provide inputs over coc ?
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.
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 ?.
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.
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; } }
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.
As AI tools become more common, we’re introducing a Responsible AI Use…
We are honored to recognize Abhilash Warrier as our Community Spotlight honoree for…
These are the community rock stars!
Stay up to date on forum activity by subscribing.
CA Neeraj Kumar 2,028
André Arnaud de Cal... 878 Super User 2025 Season 2
Sohaib Cheema 579 User Group Leader