Skip to main content
Post a question

Notifications

Announcements

No record found.

Community site session details

Community site session details

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

How to check if a column is visible?

Like (0) ShareShare
ReportReport
Posted on 18 May 2023 08:08:25 by 751

Hello,

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

Thanks.

  • Shooowtek Profile Picture
    751 on 22 May 2023 at 11:09:41
    RE: How to check if a column is visible?

    You are right, sorry for the mistake.

  • Martin Dráb Profile Picture
    231,760 Most Valuable Professional on 22 May 2023 at 11:06:24
    RE: How to check if a column is visible?

    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
    751 on 22 May 2023 at 10:18:38
    RE: How to check if a column is visible?

    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
    231,760 Most Valuable Professional on 18 May 2023 at 08:50:19
    RE: How to check if a column is visible?

    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.

  • Mohit Rampal Profile Picture
    12,556 Moderator on 18 May 2023 at 08:32:41
    RE: How to check if a column is visible?

    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.

  • Shooowtek Profile Picture
    751 on 18 May 2023 at 08:29:23
    RE: How to check if a column is visible?

    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....

  • Anton Venter Profile Picture
    19,542 Super User 2025 Season 1 on 18 May 2023 at 08:22:58
    RE: How to check if a column is visible?

    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.

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

Daivat Vartak – Community Spotlight

We are honored to recognize Daivat Vartak as our March 2025 Community…

Announcing Our 2025 Season 1 Super Users!

A new season of Super Users has arrived, and we are so grateful for the daily…

Kudos to the February Top 10 Community Stars!

Thanks for all your good work in the Community!

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 292,884 Super User 2025 Season 1

#2
Martin Dráb Profile Picture

Martin Dráb 231,760 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156 Moderator

Leaderboard

Product updates

Dynamics 365 release plans
Loading complete