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

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Finance | Project Operations, Human Resources, ...
Unanswered

How to check if a column is visible?

(0) ShareShare
ReportReport
Posted on by 843

Hello,

Is it possible to check if the user has added any new column to the grid view?

Thanks.

I have the same question (0)
  • Anton Venter Profile Picture
    20,345 Super User 2025 Season 2 on at

    From the top of my head and without checking in the application: have you tried by checking the number of columns in the grid? If you know how many columns there are to start with, then you can see if the user has added any columns.

  • Shooowtek Profile Picture
    843 on at

    I was more thinking of checking if a specific column has been added to the grid view.

    I want to add some logic depending on whether the column is visible or not....

  • Mohit Rampal Profile Picture
    12,565 Moderator on at

    Hi, The controls added by personalization are added as 'SysGen_', you can right click on form controls and check the control name. All existing fields by standard will have some meaningful control name.

    Also, if you can see Standard View in form then no new column added from UI, If there is any field added by personalization then user has to save the View and publish it if required for other users.

    I don't think its possible to check from code if field added via personalization exists in form grid.

  • Martin Dráb Profile Picture
    237,795 Most Valuable Professional on at

    Try iterating child controls of the grid and check if those user controls are there.

    for (int i = 1; i <= grid.controlCount(); i  )
    {
    	var control = grid.controlNum(i);
    }

    If it includes the control you're interested in, you'll just add code checking the particular table/field ID.

    I believe I even used it in one customization, but I'm not 100% sure.

  • Shooowtek Profile Picture
    843 on at

    Hello,

    I have a display method created on the InventSum datasoure of the InventOnhandItem form. Based on the debugging I did on this method, _inventSum is "No data selected"

    This method calls the myMethod method from the InventSum table extension.

    [ExtensionOf(formDataSourceStr(InventOnhandItem, InventSum))]
    final class InventOnhandItem_InventSum_XXX_Extension
    {
        display Qty myDisplay(InventSum _inventSum)
        {
            FormDataSource inventSum_ds = _inventSum.datasource();
            InventSum inventSum = inventSum_ds.cursor();
            FormDataSource inventDim_ds = inventSum_ds.formRun().dataSource("InventDim");
    
            return InventSum.MyMethod(_inventSum, InventDim_ds);
        }
    
    }

    [ExtensionOf(tableStr(InventSum))]
    final class InventSum_XXX_Extension
    {
        public Qty myMethod(InventSum _inventSum, FormDataSource _ds)
        {
            InventTrans inventTrans;
            InventDim inventDim;
    
            Common common = formJoinedRecord(_inventSum, _ds);
    
            if(common.TableId == tableNum(InventDim))
            {
                inventDim = common as InventDim;
            }
    
            if(inventDim.InventLocationId)
            {
                return 99;
            }
    
            return 0;
        }
    
    }

    The requirement is that the display is to show a value of 99 if the 'Location' storage dimension is enabled and not empty for the row.
    I have the same logic in AX12 and there it works without any problem. I'm trying to get it into D365, but with no results.


    Could you please help me?

  • Martin Dráb Profile Picture
    237,795 Most Valuable Professional on at

    You're in a wrong thread - this one is about "checking if the user has added any new column to the grid view". You probably wanted to put it onto your thread   .

  • Shooowtek Profile Picture
    843 on at

    You are right, sorry for the mistake.

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

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

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

#1
Martin Dráb Profile Picture

Martin Dráb 660 Most Valuable Professional

#2
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 549 Super User 2025 Season 2

#3
Sohaib Cheema Profile Picture

Sohaib Cheema 307 User Group Leader

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans