Skip to main content

Notifications

Announcements

No record found.

Dynamics 365 Community / Forums / Finance forum / Display method on a fo...
Finance forum
Suggested answer

Display method on a form grid using Table Field Group.

Posted on by 85

Hi All,

This question is on Microsoft Dynamics 365 Finance and Operations.

I have a Form A, which has a Grid that comes from its Table Field group. I have a display method that needs to be added to the existing field group. I referred various blogs and ended up creating a New field on the Field Group and marked the Data Field property as : "MyTable_Extension::description". 

Even though the build was successful, I'm unable to view this newly added display method on the Form.

I have built the solution and done a sync as well.

Am i missing something? 

Edit: I would like to add that I have created an extension of Form A from another model, into my current model.

  • Suggested answer
    nmaenpaa Profile Picture
    nmaenpaa 101,148 on at
    RE: Display method on a form grid using Table Field Group.

    Yes.

  • manasak710 Profile Picture
    manasak710 10 on at
    RE: Display method on a form grid using Table Field Group.

    I dont want to add the display method directly to form grid, instead i would like to add it to field group of a table and then call that field group in form design.

  • manasak710 Profile Picture
    manasak710 10 on at
    RE: Display method on a form grid using Table Field Group.

    Is it possible to add a display method that is part of table extension class to table field group?

  • Moeen Ahmed Sultan Profile Picture
    Moeen Ahmed Sultan 1,402 on at
    RE: Display method on a form grid using Table Field Group.

    Edited the post and added your recommendation. Thanks for correcting.

    Please verify the answer. Thanks

  • Bharath B J Profile Picture
    Bharath B J 85 on at
    RE: Display method on a form grid using Table Field Group.

    Hi Moeen,

    Your solution works if its a direct addition on the Grid. This was the one of the solutions i tried.

    To the code below,

    public static class TableA_Extension

    {

        [SysClientCacheDataMethodAttribute(true)]

        public static display Name testing(TableA _this)

        {

             //Write your logic here

             return "something";

        }

    }

    I added another line "[ExtensionOf(tableStr(MyTable))]" before "public static class TableA_Extension" and now its all working! Thanks!

  • Bharath B J Profile Picture
    Bharath B J 85 on at
    RE: Display method on a form grid using Table Field Group.

    Initially I was not able to see my method in the drop-down list.

    Now, in the display method, i added "[ExtensionOf(tableStr(MyTable))]" and then it was visible in the drop-down and that resolved my issue.

    Thanks!

  • Suggested answer
    Moeen Ahmed Sultan Profile Picture
    Moeen Ahmed Sultan 1,402 on at
    RE: Display method on a form grid using Table Field Group.

    Hi,

    If you have a FormA which uses the TableA on it's grid. You need to do the following steps to the show the column on grid using display method:

    • Create a class with the name TableA_Extension
    • Make the class public and static
    • Add a display method in the class
    • Make the method public and static
    • You class will look like as follows:
    [ExtensionOf(tableStr(TableA))]
    public static class TableA_Extension 
    {
         [SysClientCacheDataMethodAttribute(true)]
         public static display Name testing(TableA _this) 
         { 
              //Write your logic here 
              return "something";
         }
    }

    Note: testing is the name of the method

    • Add a new column on the grid
    • Set the Data source property of the column on grid
    • Set the Data method property of the column as TableA_Extension::testing 
    • Build and synchronize the project
    • Now, run the form in the browser and verify the results

  • Suggested answer
    nmaenpaa Profile Picture
    nmaenpaa 101,148 on at
    RE: Display method on a form grid using Table Field Group.

    Just add the display method to the table field group (drag-drop the method in table designer), then right click - restore on the form data source. Now the grid is refreshed and it shows also all new fields from the field group.

    Edit: sorry, the drag-drop is not possible if your method is created in extension class.

    Do you see your new method in the dropdown list where you select data method for the form field?

  • Bharath B J Profile Picture
    Bharath B J 85 on at
    RE: Display method on a form grid using Table Field Group.

    Yes Moeen. I'm able to view the other fields correctly.

  • Moeen Ahmed Sultan Profile Picture
    Moeen Ahmed Sultan 1,402 on at
    RE: Display method on a form grid using Table Field Group.

    Hi,

    Are you viewing other fields correctly?

Helpful resources

Quick Links

Replay now available! Dynamics 365 Community Call (CRM Edition)

Catch up on the first D365 Community Call held on 7/10

Community Spotlight of the Month

Kudos to Saurav Dhyani!

Congratulations to the June Top 10 community leaders!

These stars go above and beyond . . .

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 287,696 Super User

#2
Martin Dráb Profile Picture

Martin Dráb 225,490 Super User

#3
nmaenpaa Profile Picture

nmaenpaa 101,148

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans