Filtering the Users popup based on Role membership

Hey all,

Using the Users select popup in a Safeguarding custom module, for a specific field - Safeguarding Lead, I would like to be able to only return users who are in the role Senior Keyworker. Iā€™ve found some articles listed below relating to setting the Initial_Filter or setting a custom WhereStatement but I think these relate to filtering based on a field in the form, rather than a field which isnā€™t present (I may have misunderstood that though).

I think what I want to do is set a custom SQL field for the users popup on that Safeguarding Lead field to include a join to the acl_roles_users table where role_id = [id of Senior Keyworker role] but Iā€™m not sure the correct approach for this as the users popup should behave as ā€˜normalā€™ when used in other places, say for the Assigned To field for example.

Any help is appreciated as always, thanks!

Aaron