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 :
Dynamics 365 Community / Forums / Finance forum / Display method on a fo...
Finance forum

Display method on a form grid using Table Field Group.

(1) ShareShare
ReportReport
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.

I have the same question (0)
  • Moeen Ahmed Sultan Profile Picture
    1,402 on at

    Hi,

    Are you viewing other fields correctly?

  • Bharath B J Profile Picture
    85 on at

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

  • Suggested answer
    nmaenpaa Profile Picture
    101,162 Moderator on at

    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?

  • Suggested answer
    Moeen Ahmed Sultan Profile Picture
    1,402 on at

    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

  • Bharath B J Profile Picture
    85 on at

    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!

  • Bharath B J Profile Picture
    85 on at

    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!

  • Moeen Ahmed Sultan Profile Picture
    1,402 on at

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

    Please verify the answer. Thanks

  • manasak710 Profile Picture
    10 on at

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

  • manasak710 Profile Picture
    10 on at

    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.

  • Suggested answer
    nmaenpaa Profile Picture
    101,162 Moderator on at

    Yes.

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

November Spotlight Star - Khushbu Rajvi

Congratulations to a top community star!

Forum Structure Changes Coming on 11/8!

In our never-ending quest to help the Dynamics 365 Community members get answers faster …

Dynamics 365 Community Platform update – Oct 28

Welcome to the next edition of the Community Platform Update. This is a status …

Leaderboard > Finance

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans