Skip to main content

Notifications

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 218

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;
    }

}
      

  • Suggested answer
    Mohit Rampal Profile Picture
    12,558 Moderator on at
    RE: how to add search filter to display field on form d365fo .Form Customization.

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

  • Suggested answer
    GirishS Profile Picture
    27,825 Moderator on at
    RE: how to add search filter to display field on form d365fo .Form Customization.

    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.

  • JJDunaid Profile Picture
    218 on at
    RE: how to add search filter to display field on form d365fo .Form Customization.

    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.

  • JJDunaid Profile Picture
    218 on at
    RE: how to add search filter to display field on form d365fo .Form Customization.

    got you. Thanks for reply .

  • GirishS Profile Picture
    27,825 Moderator on at
    RE: how to add search filter to display field on form d365fo .Form Customization.

    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
    218 on at
    RE: how to add search filter to display field on form d365fo .Form Customization.

    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?

  • Verified answer
    Mohit Rampal Profile Picture
    12,558 Moderator on at
    RE: how to add search filter to display field on form d365fo .Form Customization.

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

    14-dynamics365.com/.../

  • Verified answer
    GirishS Profile Picture
    27,825 Moderator on at
    RE: how to add search filter to display field on form d365fo .Form Customization.

    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.

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

🌸 Community Spring Festival 2025 Challenge 🌸

WIN Power Platform Community Conference 2025 tickets!

Jonas ”Jones” Melgaard – Community Spotlight

We are honored to recognize Jonas "Jones" Melgaard as our April 2025…

Kudos to the March 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... 294,165 Super User 2025 Season 1

#2
Martin Dráb Profile Picture

Martin Dráb 232,968 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,158 Moderator

Leaderboard

Product updates

Dynamics 365 release plans