Jeremy Posted March 30, 2022 Posted March 30, 2022 I was wondering if after an email is logged is there a way to interrogate the source email to take out some information and place into a custom field. Example email: Dear Officer, Please can help me do a thing username: xxxxxxxxxx Kind Regards Jon Is there a way to grab the x's so that we can get the username and then put that username into a custom field within the request? 1
James Ainsworth Posted March 30, 2022 Posted March 30, 2022 Hi @Jeremy There is a Get Information -> Get Source Email automation. You would then have to look at the string utilities to try to get that information. Not sure it would work without testing
Steve Giller Posted March 30, 2022 Posted March 30, 2022 Also - how have you "logged the email"? By default, a Request raised from an email source (either Mailbox or Auto Responder) will have the email body in the Description, which you can easily access and pass to the string utilities.
Jeremy Posted March 30, 2022 Author Posted March 30, 2022 Yes it's how to use the string utilities is my issue, there doesn't seem to be a lot of documentation on it.
James Ainsworth Posted March 30, 2022 Posted March 30, 2022 @Jeremy I'll try and have a look at it later today to see if I can come up with something (unless @Steve Giller beats me to it ) 1
Steve Giller Posted March 30, 2022 Posted March 30, 2022 13 minutes ago, Jeremy said: how to use the string utilities Which part are you needing documentation on? If it's the 23 minutes ago, Jeremy said: Is there a way to grab the x's so that we can get the username and then put that username into a custom field within the request? part that's about constructing a REGEX query and not something Hornbill would be documenting - you'd need to check out one of the many REGEX tutorial sites for that. If it's about general configuration of the nodes that would be something we (Hornbill) could help with.
Jeremy Posted April 1, 2022 Author Posted April 1, 2022 On 3/30/2022 at 3:20 PM, Steve Giller said: Which part are you needing documentation on? I can't find documentation on the string utilities and examples from a Hornbill perspective to show what these functions can do. e.g. With the Trim option where do you enter how many characters to trim etc
Steve Giller Posted April 1, 2022 Posted April 1, 2022 2 hours ago, Jeremy said: With the Trim option where do you enter how many characters to trim The short answer there is - you don't, that's not what it's designed for:
Victor Posted April 1, 2022 Posted April 1, 2022 @Jeremy we don't have detailed wiki documentation for these utilities. They are somewhat intended for more advanced use so the naming indicates to some degree as to what the function is intended for. In any case we do document how use each function, this documentation (which is contextual) can be accessed via the ? (question mark) button when configuring the node. Example for the "trim" function:
James Ainsworth Posted April 14, 2022 Posted April 14, 2022 Hi @Jeremy The first issue with trying to extract information from an email using regex is that if the emails are manually written, there are so many ways that this could go wrong. If the email was submitted using a web form where you know the email is going to follow a set layout, this would be easier. The key Hornbill Automation is the String Utilities -> Regex Match. For the input text you can use the Get Information -> Source Email Details task. This can then feed into the Input Text as seen in the image below. The Regular expression (?<=username: )[a-z]* is in its simplest form and would need a lot added to it to consider different variants that someone may write. This expression will locate the text username: (including a space after it). It is then looking for any word that follows which will then be placed in the Results outcome, assuming that your usernames only include letters from a to z. If someone adds no space or more than one space, or they make a spelling mistake on "username" if has the potential to fail. One could continue to extend this regular expression to include further variations of the text that may be provided. The regular expression flag g is for global which just sets the match to look through the entire multiline text for the string "username: ". After the Regex Match automation, you could then follow this with the Create User Automation, using the variable for the Result outcome taken from the Regex Match automation. I hope that makes some sense.
Jeremy Posted April 19, 2022 Author Posted April 19, 2022 @James Ainsworth thank you so much that is amazing!
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now