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

Announcements

Community site session details

Community site session details

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

how to add search filter to display field on form d365fo .Form Customization.

(0) ShareShare
ReportReport
Posted on by 226

Added a new field on my form group. now i have added code and created a display method with the following code .I just want to add filter on this display field to search record.

any suggestions?

[ExtensionOf(formStr(BankAccountTrans))]
final class BankAccountTrans_ScmFormCust_Extension
{
    [SysClientCacheDataMethodAttribute(true)]

    public static display  InvoiceId markedInvoice (BankAccountTrans _this)

    {
        return LedgerJournalTrans::findJournalForVoucher(_this.Voucher,_this.TransDate).MarkedInvoice;
    }

}
      

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

    Hi Junaid,

    You cannot add search filter for display method. Thats the drawback of display method.

    To avoid this, you can create a view for the display method and add that view as form DataSource. You can add the fields from the view to the design and you will have filter automatically.

    Thanks,

    Girish S.

  • Verified answer
    Mohit Rampal Profile Picture
    12,565 Moderator on at

    Hi, You can refer this article on how to implement Girish's suggestion.

    14-dynamics365.com/.../

  • JJDunaid Profile Picture
    226 on at

    i totally understood what you are saying, but in my case i have added  field into "Field group" of table as i wan to add field inside the field group .

    but when i will create a view (the  view field will be added  into the grid ) its field will be added on "form grid" outside the field group. I have to add the field in "field group". in that case , what will be the scenario?

    any guidance?

  • GirishS Profile Picture
    27,833 Moderator on at

    My suggestion will be hiding the current grid and creating a new grid with all the available fields along with the fields from the view.

    Thanks,

    Girish S.

  • JJDunaid Profile Picture
    226 on at

    got you. Thanks for reply .

  • JJDunaid Profile Picture
    226 on at

    Hi Girish,

    found this, article for adding search filter on display field. Can you help me understand how "Override Context method of Form control " while I am doing form customization.

    according too my knowledge i can not override a method while I'm customizing a form.

  • Suggested answer
    GirishS Profile Picture
    27,833 Moderator on at

    You are adding display method on the standard form - If it's your custom form you can override the context method of display method control. But since it's a standard form there is no event available for context method.

    But you can write COC for context method.

    [Extensionof(formControlStr(FormName, ControlName))]
    internal final class ClassName_Extension
    {
        public void context()
        {
            next context();
            //add the code as mentioned in the blog.
        }
    }

    I am not sure about adding the filter to display method on the blog you posted. But you can give it a try and let us know the output.

    Thanks,

    Girish S.

  • Suggested answer
    Mohit Rampal Profile Picture
    12,565 Moderator on at

    Context method is called when user right click on field and gets the context menu with options. As per below article, Options to 'Filter by Field', Filter by Selection were added in the code. 

    msddax.wordpress.com/.../

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... 634 Super User 2026 Season 1

#2
Abhilash Warrier Profile Picture

Abhilash Warrier 361 Super User 2026 Season 1

#3
Giorgio Bonacorsi Profile Picture

Giorgio Bonacorsi 283

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans