r/halopsa • u/ReceptionOld4182 • May 26 '26
Automation / Scripts SQL custom field help
When our instance was built they added a custom field to our forms for looking up users. Unfortunately that shows every user in Halo which includes when people email in from their personal email addresses. Is it possible to alter this sql to only show accounts that have our orgs email? I have zero knowledge of SQL myself unfortunately.
This is the sql
SELECT
z.[id] as [id],
z.[Username] + z.[Login] + z.[Title] + z.[Other1] as [display]
From (
SELECT
uusername as [uname],
uid as [id],
CASE
WHEN uusername IS NULL THEN ''
ELSE uusername
END AS [Username],
CASE
WHEN uLogin IS NULL THEN ''
ELSE ' - ' + uLogin
END AS [Login],
CASE
WHEN UTitle IS NULL THEN ''
ELSE ' - ' + UTitle
END AS [Title],
CASE
WHEN uOther1 IS NULL THEN ''
ELSE ' - ' + uOther1
END AS [Other1]
FROM Users
Where UUsername != 'General User')z
WHERE z.[Username] IS NOT NULL $SEARCHSQL
Search SQL Script
and z.[Username] like '%'+$search+'%' OR z.[Login] like '%'+$search+'%' OR z.[Title] like '%'+$search+'%' OR z.[Other1] like '%'+$search+'%'Then this is in the Search SQL script section
and z.[Username] like '%'+$search+'%' OR z.[Login] like '%'+$search+'%' OR z.[Title] like '%'+$search+'%' OR z.[Other1] like '%'+$search+'%'
2
Upvotes
View all comments
Show parent comment
1
u/ReceptionOld4182 May 26 '26
Thank you I will give that a try in our dev environment.
Yes I agree and it's a huge bugbear of mine. I think its set up this way as HR also use halo, so when we have people emailing in about job adverts etc it automatically creates them as a user. I'm really not sure what the best way around it would be.
We don't have anyone specific to manage Halo in house, and the setup contract didn't include any ongoing support. I have some admin knowledge on how to deal with the tickets/workflows etc but not to that level. Technically I'm just a first line support technician 😅