How to lookup drugOrders in HTML form entry

Tags: #<Tag:0x00007f0a2ed93980>

Hello, I would like to make a lookup of a drug order on an HTMLFormEntry.

<lookup complexExpression="#foreach($order in $fn.allDrugOrders(1085)) $order #end" />

But it seems that this method doesn’t exist: $fn.allDrugOrders.

So My question is, is there any alternative? Maybe a custom function that read from the database table directly? Thank you in advance.

Can you give some bit of background for your exact use case?