Notifications
Announcements
No record found.
Hi,
I have to disable this Edit Button based on my requirement. I know how to do for normal Button. When i use The Name Of the Menuitembutton('Edit') in the code it takes as a Keyword 'Edit'. How to solve this?
Regards,
Ram.
HI Ram,
You can refer to this DOC:docs.microsoft.com/.../how-to-enable-and-disable-an-action-pane-button-on-a-list-page
Besides that , you can try to set security.
Hi Blue Wang,
In My Requirement there is no need to set security. Based on the text on the grid string edit control the Button Should be Disabled.
Ram
You're looking at the problem from the wrong perspective.
Your actual goal isn't disabling the button, but making the datasource non-editable. To do that, change AllowEdit property of the datasources. Because you want to do it conditionally from code, get a reference to the right FormDataSource object and then call allowEdit(false).
Hi Martin,
My Actual Requirement is when the Value in the String edit control in the Grid == 'Something'. The Menuitem Button i have mentioned should be disabled. When You see this code Edit is the name of the button.But i cant use that control because Edit is a Keyword.
if(AssetTable_AssetGroup.text()=='BUILDINGS') { Edit.enabled(true); }
The Edit button will be disabled when the data source is set not to be editable.
Your can't work because there it no form control with Name = Edit. You're confusing UI labels with controls names.
See Here The Name Of the Button is Edit How can i Access this Control. That is what my problem now.
Aha, so this question is about a listpage, not a normal form. List pages aren't editable at all, therefore the button redirects you to another form.
And you're trying to modify it as if it was a normal form and not a listpage. I see you added an additional datasource outside the query and you're trying to write code inside the listpage instead of the listpage interaction class. That's not the right approach.
Please look at the link in Blue Wang's reply and related documentation pages to get some idea about how to use listpage forms. Feel free to ask if needed; now when we know what you're doing it'll be easier to help.
See the below image For Reference. My Condition is when the Fixed Asset Group is not equal to 'BUILDINGS' it should be Disabled. I Used Editingrid Button instead of Edit Button it works Fine. But i am unable to Access the Edit Button in my Code. Since it is a keyword ("Edit"). I Hope you understand with my images.
It still seems to me that you're doing a wrong thing.
But yes, X++ keywords can't be used as variables names. If you want to refer to the button by its name in X++ through auto-declaration, it name mustn't be 'Edit'. Note that you can use other ways to get a reference to the control, such as this.design().controlName('Edit').
Here is my Code but when i run my code this throws an error Formrun object not initialized.
Args args = new Args(); FormRun formrun; args.name(formstr(Assettablelistpage)); formrun = classfactory.formRunClass(args); if(AssetTable_AssetGroup.text()!='BUILDINGS') { formRun.design().controlName(formControlStr(Assettablelistpage, Edit)).enabled(false); } else { formRun.design().controlName(formControlStr(Assettablelistpage, Edit)).enabled(true); }
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 565 Most Valuable Professional
André Arnaud de Cal... 450 Super User 2025 Season 2
Sohaib Cheema 250 User Group Leader