Link select values with api response

Extending on this

want to achieve something similar to this. Have tried reading and implementing
https://frappeframework.com/docs/user/en/guides/app-development/overriding-link-query-by-custom-script#2-calling-a-different-method-to-generate-results

but this seems different from my usecase.