Notifications
Announcements
No record found.
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 he creates a new record, the button should be visible or enable.Consider the button names as open and close.
Thanks in advance.
Hi Barath,
You can use FormDatasourceName to check whether there is any record or not. Based on that you can enable disable button.
Make the Auto declaration of the button control to Yes. Assuming it as a custom form.
public int active() { int ret = super(); if(FormDataSourceName.RecId) { control.enabled(true); } else { control.enabled(false); } return ret; }
Thanks,
Girish S.
Hello Barath,
Going by design, you might want to enable/disable a button or a form control based on another field of the current record on a form.
An example is, you want to disable the post button on a journal when the posted field is NoYes::Yes.
This thread will give you an idea.
community.dynamics.com/.../how-to-disable-a-button-on-a-form-based-on-the-selected-record
I didnt quite get this one.
Whether it is helpful to enable or disable specific button alone in a form, for example I have mentioned only 2 buttons open and close. If so, I have to change this line of code to what ?
control.enabled(true)
you need to mention both the controls.
control1.enabled(true);
control2.enabled(true);
Thanks
Hi, if your requirement is to enable the buttons only when form has some records then you can use NeedRecords property in buttons in your form.
Can you confirm whether this is appropriate
Open.enabled(true);
Close.enabled(true);
Yes like that you need to add.
Hi Mohit,
Thanks for your info. But I have already enabled it but that didnt work.
Barath Ram J
If this has to be implemented in active method, can you send a full set of sample code to implement this one ? I am getting lots of error while trying this.
Hi C4u,
Please, do you have the exact requirements as Barath Ram?
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 Neeraj Kumar as our Community Spotlight honoree for…
These are the community rock stars!
Stay up to date on forum activity by subscribing.
Martin Dráb 646 Most Valuable Professional
André Arnaud de Cal... 529 Super User 2025 Season 2
Sohaib Cheema 285 User Group Leader