Sorting Link Field Results by “Last Modified” in Frappe

I have a Link field where I’m selecting Purchase Orders.

I want the dropdown results to be sorted by “Last Modified” (latest first).
Applying filters works fine, but I’m unable to control the sorting.

Is there any way to configure or control the sorting of results in a Link field (e.g., by modified date) without using custom scripts like set_query?

Looking for a simple or standard approach if available.

1 Like

Without using set_query(), there is no standard built-in way in Frappe to control Link field dropdown sorting by Last Modified. Default sorting is handled by the framework/search logic.

So the practical options are:

  1. Accept default behavior

  2. Customize server-side link search logic

  3. Use custom script (set_query())

If avoiding scripts, server-side customization is the only real option.