Parsing description of issues created by email

Issue #133 resolved
Adhip Pokharel created an issue

Hi Fidel,

Hope you are doing good. I wanted to follow up with you on this:


By the way, I recall a feature you wanted to implement long time ago for parsing description of issues created by email. If you want to give it a try again, I will be glad to help you. Since then, I have implemented that functionality in other users, and I think this time we will succeed.

We want this feature to work now. Could you please help us? We do not want the entire description of issues but just the email and name of the person when issues are created via email. Please see the screenshot.

Thanks Adhip

Comments (38)

  1. Fidel Castro Armario repo owner

    Can you please, copy+paste an example of an issue description? I need a real description to test my solution.

    If you have privacy concerns, you can send it to me by email at fidel@workflowarts.com.

  2. Fidel Castro Armario repo owner

    In your previous screenshot the email was between < > characters. Are they missing by mistake in your c+p example?

  3. Adhip Pokharel reporter

    Sorry about that. Yes, the emails are in between <> characters. I must have mistakenly deleted it when changing the email address. Her's how it looks:

    [Created via e-mail received from: Peter Barnes test@gmail.com]

  4. Adhip Pokharel reporter

    Looks like this comment box is automatically changing the email to the format above.

  5. Fidel Castro Armario repo owner

    Use "Copy a parsed text to a field" with the following configurations:

    Capture "User Name":

    conf-2.png

    Text to be parsed is:

    replaceFirst(replaceFirst(%{00001}, "(?s)^.*Created via e-mail received from:\\s*", ""), "(?s)\\s*<.*$", "")
    

    Capture "Email":

    conf-1.png Text to be parsed is:

    replaceFirst(replaceFirst(%{00001}, "(?s)^.*Created via e-mail received from:.*<\\s*", ""), "(?s)\\s*>.*$", "")
    
  6. Adhip Pokharel reporter

    Thanks, Fidel. Is this a post function on the "Create Issue" transition? Also, where is the filed value of the custom field where we are parsing the name and email used?

  7. Fidel Castro Armario repo owner

    You can use these post-functions in any transition of your workflow. If you use them in "Create Issue" transition, insert them after "Creates the issue originally" post-function.

  8. Adhip Pokharel reporter

    Sorry, i edited my comment and you may have missed my last question.

    Where is the filed value of the custom field where we are parsing the name and email used?

    For eg: We will have a custom field called "Client Contact" (a single line text field) where we want the parsed name and email address to appear.

  9. Fidel Castro Armario repo owner

    In my example I have used two single line text custom field called "Email" and "User Name". Select in parameter "Target field" your desired custom fields to receive the parsed values.

  10. Adhip Pokharel reporter

    Perfect, thanks. I was thinking to use one custom field for both email and name but using separate fields will work for us too. At this point, i have everything i needed to ask you. I will test this on our Dev environment of JIRA in a bit and let you know how it goes.

  11. Adhip Pokharel reporter

    Hi Fidel,

    This worked great. Yay :) A big thanks to you. There is nothing we have not been able to do with your plugin and the service you provide is excellent times infinity :)

    Thanks again.

    --Adhip

  12. Adhip Pokharel reporter

    Hi Fidel,

    I appreciate you following up on this issue. It is working great for us at the moment. if this is a much better way, i will definitely take a look at it.

  13. Fidel Castro Armario repo owner

    I advice you not to touch your current configuration. I only inform you just in case you need to parse any other field in the future for extracting data.

  14. Adhip Pokharel reporter

    Sounds good, Thanks. We may explore this more in future. As of now, we are good. Appreciate the follow up

  15. Adhip Pokharel reporter

    Hi Fidel,

    I hope you are doing well. We've run into an issue with this configuration.

    As you know, you helped us parse the email and name from the description to a text field when issues were created via email. Recently, we have run into issues when someone is trying to create the ticket manually. The description box is trying to parse everything to the custom fields and is throwing errors. The custom fields are text fields less than 255 characters and it is not able to hold characters greater than that. If you would like to know the exact scenario, i can send you an email with the errors we get. For now, please look at what Atlassian told me couple of hours ago. After going back and forth with them since two weeks, they were finally able to figure out the cause for this issue today.

    Thanks for the workflow export. It looks like there's a Post Function on the Create Issue transition in this workflow, which is using the JIRA Suite Utilities plugin to write data to the problematic field on issue the issue create transition. Here's what this looks like in the XML.

    <arg name="full.module.key">com.fca.jira.plugins.workflowToolbox.workflow-toolboxcopy-parsed-text-function</arg> <arg name="textToParse">replaceFirst(replaceFirst(%{00001}, "(?s)^.Created via e-mail received from:\s", ""), "(?s)\s<.$", "")</arg> <arg name="class.name">com.fca.jira.plugins.workflowToolbox.CopyParsedTextFunction</arg> <arg name="selectedTargetGeneralizedField">11004</arg>


    Please advise

    Thanks Adhip

  16. Fidel Castro Armario repo owner

    For parsing the email use "Parse field for extracting data" with the following configuration:

    email-1.png email-2.png

    • Leading delimiter:
    #!
    Created via e-mail received from:.*<\s*
    
    • Trailing delimiter:
    #!
    \s*>
    

    For parsing the user name use "Parse field for extracting data" with the following configuration:

    username-1.png username-2.png

    • Leading delimiter:
    #!
    Created via e-mail received from:\s*
    
    • Trailing delimiter:
    #!
    \s*<
    

    Once configured, both post-functions look like this:

    final-config.png

  17. Adhip Pokharel reporter

    Hi Fidel,

    I appreciate you posting the instructions along with screenshots. Before trying this, could you please let me know the difference between this configuration and the one we are using today. The one we're using today is working great as well in terms of parsing the name and email to a text box when issues are created via email. it's just that it's throwing errors when issues are manually created, instead of email.

    Here's our current configuration:

  18. Adhip Pokharel reporter

    Hi Fidel,

    Never mind. I deleted the old configuration and applied the new one you mentioned above on our JIRA Sandbox and the error is now gone. Email and Name fields worked as expected. I am currently in process of updating the plugin to version 2.1.34 on Production and making the change there. Again, i appreciate your help.

    --Adhip

  19. Fidel Castro Armario repo owner

    Great Adhip! Another advantage of the new post-function is that it has a more intuitive configuration for parsing data.

    I close issue.

  20. Adhip Pokharel reporter

    Hi Fidel, We want to revisit this and parse the contact name from the description field (example below) to a custom field called "Client Contact". Is the last configuration you gave me still good or do you have something new?

    Created via e-mail received from: "Pokharel, Adhip" xxxx@gmail.com

    So, we want "Adhip Pokharel" to be parsed to the custom field Client Contact.

  21. Fidel Castro Armario repo owner

    Hi Adhip,

    Use the following configuration:

    Captura de pantalla 2016-11-12 a las 0.23.27.png

    Leading delimiter:

    Created via e-mail received from: "
    

    Format of the value to be extracted:

    \w+(,\s*)?\w+
    

    Trailing delimiter:

    "
    

    I have detected a problem: when you try to edit the configuration the values are not retrieved correctly. I will fix the problem in next version of the plugin. Anyway, it will work, since the values are correctly used by the post-function.

  22. Adhip Pokharel reporter

    Hi Fidel,

    So do you want us to try this configuration or wait until the next version of the plugin is released? We are using an old version (2.2.8) in our Production environment at the moment.

  23. Fidel Castro Armario repo owner

    You can use your current version. The only problem is that if you try to edit the configuration of the post-function, some configuration values are retrieved incorrectly, and you will have to rewrite them again.

  24. MAG-II

    Hi Fidel -

    I have been trying to follow the above steps with the "Parse field for extracting data" post function. I have a JIRA Service Desk project. When customers send an email an Issue gets created. I am trying to parse the body of the email (Description) and populate that parsed text to a custom field. Attached are my configurations. I am a bit lost at this point. Any advice?

    Parse Text Configuration.PNGPost Function Order.PNG

  25. MAG-II

    My apologies - just realized I posed this on the old website. Will create a new issue on your new website.

  26. Log in to comment