Copy Parsed Text to a Field Post Function not working

Issue #455 resolved
Nikhil created an issue

Hi Team, I need a favor as we have got an high priority request from our clients. The request is: Whenever a Jira ticket is created (this happens from email to jira ticket conversion), the second line in the Description field (contains the timestamp of the ticket)should be copied to newly created Custom field and should be visible in the view screen of the same issue. We have Jira workflow tool box plugin installed and we are trying but failing as we are getting errors. Could you please help us in getting the desired output? In the below description, we want only "Dec 7, 2016 2:10:25 AM PST" to be copied to new field whenever an issue is created for all the projects in Jira. Description: The following is an automated response sent to you by the QRadar event custom rules engine: Dec 7, 2016 2:10:25 AM PST Rule Name: Successful Outbound Communication to a Foreign Country/Region Rule Description: This rule will fire when the system detects a potential connection to a BotNet command and control host.

Regards, Nikhil

Comments (36)

  1. Fidel Castro Armario repo owner

    Which type is the custom field you want set? Text, Date Picker or Date-Time Picker?

  2. Nikhil reporter

    Since "Dec 7, 2016 2:10:25 AM PST" is the output i am expecting to be copied to new custom field, i think it would be better to have text i guess. What would you recommend?

    Nikhil

  3. Fidel Castro Armario repo owner

    Text field is easier, but we should be able to store it in a date-time custom field also.

    Please, attach a screenshot of the issue detail screen. I want to see how the description looks like in JIRA, as when you copy the description here the return characters are removed.

  4. Nikhil reporter

    Here is the attached screenshot of the Description content from which i want i mentioned strip of data to be extracted and copied to a new custom field.

  5. Fidel Castro Armario repo owner

    You can do it using "Parse field for extracting data" post-function with the following configuration:

    Captura de pantalla 2016-12-08 a las 8.27.32.png Captura de pantalla 2016-12-08 a las 8.27.49.png

    Leading delimiter is:

    QRadar event custom rules engine:\s*
    

    Trailing delimiter is:

    \s*Rule Name:
    

    Select in parameter Target field the text field you want to betset.

  6. Nikhil reporter

    Perfect!! Got the desired output. Thank you so much and i will get back to you guys if i need any more help!!

    We can close the ticket for now.

  7. Nikhil reporter
    • changed status to open

    Hi,

    This is happening with Text custom field, can we make it happen with Date-Time picker type custom field? Please reply asap as it is critical.

    Nikhil

  8. Fidel Castro Armario repo owner

    Try the following changes:

    • Format of the value to be extracted: date-time with the following format:
    MMM d, yyyy h:mm:ss a z
    
    • Target field: a Date-Time Picker custom field.
  9. Nikhil reporter

    The Custom field is not appearing in the View screen after making this change while earlier it was showing up with Text field. Am I missing anything? Does having time zone "Dec 7, 2016 2:10:25 AM PST"[ PST in this case] is stopping?

    Nikhil

  10. Fidel Castro Armario repo owner

    This change is for setting a Date-Time Picker custom field instead of a text field. The provided format pattern considers the timezone (is the z at the end).

    Have you checked whether the Date-Time Picker is being set?

    Do you want to keep setting the text field along with the setting of the Date-Time Picker? In that case you should add a second "Parse field for extracting data" post-function.

  11. Nikhil reporter

    First we tried with text field, but the team wants to generate reports in future, so they want this content to be copied to a date-time picker. The new custom field I selected is "Alert Time" which is a date-time picker. This is how the post-function looks like after configuring:

    Write into Alert Time a piece of information extracted from Description. Format of value to be extracted is a date-time with the following format: MMM d, yyyy h:mm:ss a z

    Leading delimiter is the following regular expression ignoring case: QRadar event custom rules engine:\s*

    Trailing delimiter is the following regular expression ignoring case: \s*Rule Name:

    In case of multiple matches extract only first occurrence. This feature will be run as user in field Current user.

    Nikhil

  12. Fidel Castro Armario repo owner

    Can we have a video-conference with screen-share through Skype? I would like to do some tests in your system.

    My Skype user is fidel100r. I will be available until 13:30 UTC.

  13. Nikhil reporter

    We do not use Skype in our company and we need to take certain approvals to get it installed. Can you please tell me if I can perform those tests on your behalf? Can we achieve it with any other post-function like Copy Parsed Text to a Field?

  14. Fidel Castro Armario repo owner

    Ok, follow the following steps:

    1. Create to Text (255 char) custom fields called Date-Time Value and Date-Time Format.
    2. Add the 2 fields of the previous step to EDIT and VIEW screens.
    3. Choose a transition in your workflow that can be executed many times for a same issue, and insert "Mathematical and date-time expression calculator" post-function with the following configuration:
    • Target field: Alert Time
    • Parsing mode: advanced
    • Text to be parsed:
    stringToDate(%{aaaaa}, %{bbbbb})
    

    replacing aaaaa with field code for Date-Time Value, and bbbbb with field code for Date-Time Format.

    Now, we will input pairs of value/format in fields Date-Time Value and Date-Time Format, and check whether Alert Time is correctly set.

    Try the following pairs:

    1)

    Dec 7, 2016
    MMM d, yyyy
    

    2)

    Dec 7, 2016 2:10:25
    MMM d, yyyy h:mm:ss
    

    3)

    Dec 7, 2016 2:10:25 AM PST
    MMM d, yyyy h:mm:ss a z
    
  15. Nikhil reporter

    Actually the requirement is "To see if we can convert any time zone to one standard time zone and auto calculate time delta between JIRA ticket creation to the alert creation time." Is there any way we can achieve this? This is the main purpose. So, the new custom field that holds the parsed text should be able to calculate the time difference between the 2 creation times.

    Nikhil

  16. Fidel Castro Armario repo owner

    Once we achieve to set Alert Time Date-Time Picker with the string representing the date-time value, we can do any time calculation we require.

    The first step is to set Alert Time field.

  17. Nikhil reporter

    Calculation is not happening instead it is displaying the contents placed in the new fields:

    Type: Service Request Status:IN QUEUE (View Workflow) Priority: Medium Resolution: Unresolved Labels:None Labels Impact: Medium Impact Ticket - Incident / Service Request: Service Request Date-Time Value: Dec 7, 2016 2:10:25 AM PST Date-Time Format: MMM d, yyyy h:mm:ss a z

    Post-function looks like this:

    Field Test Alert Time will be assigned with the calculation result of the formula: stringToDate(%{Date-Time Value}, %{Date-Time Format}) This feature will be run as user in field Current user.

  18. Fidel Castro Armario repo owner

    Try replacing "Dec" in the date-time value strings with the 3 characters for that month in your mother language (I'm guessing that's the Locale of your server). For example, in Spanish is "Dic".

  19. Nikhil reporter

    It should be Dec only.

    Can't we do it the same way we did with Text field using "Parse field for extracting data" post-function? This method is not working out. The same field is getting copied.

    Nikhil

  20. Fidel Castro Armario repo owner

    Sorry Nikhil,

    I don't understand what you mean with "The same field is getting copied.". I'm assuming that Alert Time is a Date-Time Picker, thus a text string value can't be copied into it.

    Can you, please, clarify what you mean?

  21. Nikhil reporter

    I have created 2 new custom fields Date-Time Value and Date-Time Format as a multi-line Text custom field type and added to both Edit and View screens. Test Alert Time field is a date-time picker. Whenever I enter the pairs in the Edit screen for those 2 fields, the same 2 Date-Time Value and Date-Time Format field's values are shown in the View screen instead of calculating, i.e., the view screen shows the below output for both the fields and test Alert Time field doesn't show up in the view screen:

    Dec 7, 2016 2:10:25 AM PST MMM d, yyyy h:mm:ss a z

    This is the post-function i added to one of the transitions:

    The following text parsed in advanced mode will be copied to Test Alert Time: "stringToDate(%{Date-Time Value}, %{Date-Time Format})" This feature will be run as user in field Current user.

    Nikhil

  22. Fidel Castro Armario repo owner

    I told you to use Mathematical and date-time expression calculator post-function. You are using a wrong post-function.

    Fields Date-Time Value and Date-Time Format will not be changed. I expect field Alert Time to be set. Date-Time fields are shown on the right hand side of the screen.

    You should execute the transition in order to execute the post-function.

  23. Nikhil reporter

    I would like to have a Skype call tomorrow regarding this. I have installed Skype now. Please let me know when we can have call. Sent you request as well.

    Nikhil

  24. Nikhil reporter
    • changed status to open

    Hi,

    Thank you for you support Fidel, but we are observing a strange behavior since we configured. When an issue is created in Jira, we are getting 3 notification mails which are duplicates instead of getting one notification mail. Before we thought of moving it to the Production this started. Could you please tell me why this is happening? We cna have a short call like earlier and discuss the same.

    Nikhil

  25. Fidel Castro Armario repo owner

    Can you please attach a screenshot of the post-function's tab of "Create Issue" transition? I would like to see all the post-function's being executed, and the order of execution.

    Later we can have a video-conference if it were necessary.

  26. Fidel Castro Armario repo owner

    I don't see how those post-functions can have any relation with notifications by email. Please, do the following test:

    Write the following boolean expression in parameter "Conditional execution" in post-functions 2 to 6:

    false
    

    This way post-functions are disabled. After that, check whether the duplicated notifications keep happening. In case they stop happening, enable the post-functions one by one until you find out which post-function causes the duplicated notifications.

  27. Nikhil reporter

    Why are we getting this error when an issue is created?

    Error creating issue: Error: null value at right hand side operand in arithmetic subtraction operation.

  28. Fidel Castro Armario repo owner

    Because you have disabled post-function 3 and Ephemeral number 1 is not set in post-function 4. Don't disable post-function 3.

  29. Nikhil reporter

    Hi Fidel,

    Now comes a twist in the story.

    Because of these post-functions, the issues are getting created only if the Description field is containing the context from where the parsing is happening, else it is throwing the above error. We should be able to create issue even if the Description has some other content, which is not allowing at this moment. Please suggest so that the issues are created even if the description field has different content and make these post-functions work accordingly and optionally. Let's have call or chat to get clear understanding.

    Nikhil

  30. Fidel Castro Armario repo owner

    Hi Nikhil,

    Try setting parameter Conditional execution in post-functions 4, 5 and 6 like this:

    conditional-execution.png

    Boolean expression is:

    {00058} != null
    

    where {00058} is code for numeric value of Ephemeral number 1.

    Let me know whether it solves your problem.

  31. Log in to comment