We have a new product with a built in help request system. The system sends an email based on the form the user fills out and information provided by the server. We plan on capturing the email in an Incident and I am trying to figure out how to take the information and set the Contact on the Incident. Unforuntately HelpDesk wants the Contact ID which is not very usable. The email contains the user's NT ID in the subject line so I was hoping to parse the Title with a SQL query and do a search to find the Contact ID associated with that NT ID. I am trying to embed it in an Incident Rule to change the contact from unknown to a known user.
Here is what I have so far:
HDQUERY[[SELECT contact_id FROM contact_view WHERE contact_nt_id LIKE N'%(RIGHT($$workitem_title$$,7))%']]
I have tried stripping the query down and putting it into workitem_comment to I can review the output.
HDQUERY[[SELECT RIGHT(WORKITEM(workitem_title),4)]]
But it doesn't work with text, only fields with numbers like workitem_number. I have changed it to read other fields and they work as long as there are only numbers. When I setup the Advanced Assignment it select Text so there shoul't be an issue. Can anyone find what I am missing? Is there another method to grab the last 7 characters of a title and use the string to find a Contact with a matching NT ID?