web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

No record found.

News and Announcements icon
Community site session details

Community site session details

Session Id :
Finance | Project Operations, Human Resources, ...
Suggested Answer

Setting a button's text and visibility in a grid based on conditions

(0) ShareShare
ReportReport
Posted on by 15

Hello,

I'm trying to put a column on a form grid that acts like a button (either it is a button, or is clickable text), where the buttoncontrol.text() and the buttoncontrol.visible() will change according to certain conditions. For example: in Row 1 condition A is true, button.visible = false and button.text = 'empty string'. In Row 2 condition A is false, set button.visible = true and button.text = 'true'.

The data source on the form/grid is a View generated from a query. "Condition A" is a computed column on the view, ie "if Condition A, set button text = 'lorem ipsum' and visible = true".

pastedimage1666196043908v2.png

How would you go about doing something like this? Is it possible to create a method call/override in the form to loop through the rows/buttons and check conditions per row, then set visible/text on a button, per row? 

It needs to be clickable because clicking the enabled/visible button takes args from the row and links to another form based on those args. I have that bit working but I can't for the life of me figure out how to set text on a button per row, based on args from that row. 

This is on a net new/custom form, view, and query.

I have the same question (0)
  • Suggested answer
    GirishS Profile Picture
    27,833 Moderator on at

    If you are adding a view as datasource to a form you don't have access to CRUD operations.

    My suggestion will be creating a display method on the form instead of controls.

    Also display method will view only data you cannot edit it.

    Thanks,

    Girish S.

  • Dynamics-user-185 Profile Picture
    15 on at

    If you are adding a view as datasource to a form you don't have access to CRUD operations.

    I don't want to CUD, but I do wish to Read - ie Read the value of a field in a record and set the text of a form control. Is that not possible?

    My suggestion will be creating a display method on the form instead of controls

    I have a display method, as shown in the screenshot above. The 'Coll Status' column is a display method. However, I don't think it's possible to make that display method a clickable button, which is what I'm trying to accomplish. Either make the display method clickable, or find out how to make a clickable button update according to the applicable record. 

    Also display method will view only data you cannot edit it.

    i don't want to edit the data, only Read the data and set the button.text() based on the Read data. 

  • Martin Dráb Profile Picture
    238,759 Most Valuable Professional on at

    You can't set visibility on individual cells in a grid. You can only hide the whole column, which clearly isn't what you want. But you can use empty values in those cells.

    Regarding the button, why you can't you follow F&O form patterns and place the button in a toolbar above the grid? Please check out Toolbar and List subpattern.

  • GirishS Profile Picture
    27,833 Moderator on at

    What about edit method?  

    Refer to the below URL for edit method. Check whether edit method can suit your scenario.

    https://dynamics365musings.com/d365-edit-method/

    Thanks,

    Girish S.

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

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Stars!

Congratulations to our 2025 Community Spotlights

Thanks to all of our 2025 Community Spotlight stars!

Leaderboard > Finance | Project Operations, Human Resources, AX, GP, SL

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 509 Super User 2026 Season 1

#2
Giorgio Bonacorsi Profile Picture

Giorgio Bonacorsi 375

#3
Adis Profile Picture

Adis 268 Super User 2026 Season 1

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans