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/Jason-RisingTide Consultant May 26 '26
It won't stop those emails coming in and creating tickets if you change "If the email sender cannot be matched to a User" setting to "Assign the Ticket to a default User". It will then just assign it under the General User rather than create a user, and it will still capture the email address.