Copy a linked issue key to the beginning of the Summary field

Issue #241 resolved
Shai Dahan created an issue

Hello Fidel,

I hope you are keeping well.

I would link to know if there is a way I can run a post function, which will copy the key of an issue link (type: "related to") to the beginning of the summary field. Can I parsed this value in some sort of a way?

Comments (17)

  1. Fidel Castro Armario repo owner

    Where do you want to execute the post-function, in the issue which is going to get updated its Summary, or in the issue whose issue key is going to be copied to linked issue's Summary?

    Do you want to add the issue key at the end of the Summary?

  2. Shai Dahan Account Deactivated reporter

    In the issue which is going to get updated its Summary. I already have a post function, which create an issue in a different project and link it to the original issue. Now I would like to edit the summary of the original issue in that manner: [%link_issue_key%] - %original_summary%

    The post function which I already have (and is working) is:

    *Create issue Conditions:

    Condition value: %original_priority%, Regex pattern: (Priority 1)|(Priority 2)|(Priority 3)
    

    Summary: [%original_key%] - %original_summary% Description: %original_description% Priority: %original_priority% Customer or Admin Username: %original_customfield_10902% Date/Time of Customer Session: %original_customfield_11000% Brand: %original_customfield_10305% Game Name: %original_customfield_12300% Components: %original_components% Project: [OCC] Gala Coral Interactive OCC Issue type: Incident (10) Priority: Parent's priority Reporter: Specific user (cs.supervisors) Assignee: Unassigned Affected versions: None Fixed versions: None Components: Parent issue's components Link: %original_key%, Link type: Relates, Link direction: From new issue to issue key Attachments: %original_key% Watchers: %original_watchers%*

  3. Fidel Castro Armario repo owner

    You can do it using "Read fields from linked issues or subtask" post-function with the following configuration:

    conf-0.png conf-1.png conf-2.png conf-3.png conf-4.png

    Parameter "Source value" is:

    "[" + ^%{00015} + "] - " + %{00000}
    

    Parameter "Filtering by field values" is:

    {00057} - ^{00009} < 10 * {SECOND} 
    

    I'm assuming that you are creating the issue in the same transition that your are updating the summary, so I have added a time filter in parameter "Filtering by field values" in order to avoid reading other previous created linked issues.

    I'm also assuming that first status of your newly created issue is "Open". Please, check the correct one for your workflow.

    It's possible that selected issue link type direction is incorrect, since both directions are called identically ("relates to"). You can select both direction if you find that your first configuration doesn't work.

  4. Shai Dahan Account Deactivated reporter

    Thank you very much Fidel, I will try this first on our test Jira instance and will let you how it goes.

  5. Shai Dahan Account Deactivated reporter

    I've done it a separate transition; after the linked issue has been created

  6. Fidel Castro Armario repo owner

    Please, do the following changes:

    • Clean parameter "Filtering by field values".
    • Uncheck all the statuses at parameter "Filtering linked issues or subtasks by status".
    • Check both "relates to" values at parameter "Filtering by issue link type".
  7. Shai Dahan Account Deactivated reporter

    Excellent :)

    Yes this is working as expected.

    Another think I want to ask you if there is a way to clone comments from the OCC isse to the GI link issue and only it this direction.

    In our example; if a comment have been added in OCC-20370 I would like it to be added in GI-25273

    Is it possible?

  8. Fidel Castro Armario repo owner

    I will give you a possible solution, but it will require next version of the plugin. I will keep you informed.

  9. Shai Dahan Account Deactivated reporter

    OK, fair enough.

    I really thank you for your support.

    It is really remarkable.

  10. Shai Dahan Account Deactivated reporter

    If you going to include this in your next version, can you also include attachments as well?

    So when a user add an attachment on the original issue, it will be added to the linked issue.

  11. Fidel Castro Armario repo owner

    Hi Shai, I will explain how to copy comments and attachments from an issue to a linked issue. To do it you will need to use:

    1) Create 2 global reflexive transitions: "Clone Last Comment" and "Clone Attachments". Global means that it's available to all status, and reflexive means that it goes to the same status, i.e., it doesn't change current issue status:

    Captura de pantalla 2016-02-28 a las 12.27.02.png

    2) Add "Write field on linked issues or subtasks" to transition "Clone Last Comment" with the following configuration:

    • Source value: Last comment
    • Target field: New comment
    • Rest of parameters: select issue link types, issue types, etc. according to the linked issue you want to copy the comment to.

    Important Note: due to a bug in JIRA you will need to use TEXT workflow edition mode to add post-function to global reflexive transitions.

    3) Add "Write field on linked issues or subtasks" to transition "Clone Attachments" with the following configuration:

    • Source value: Attachments
    • Target field: Attachments (only new attachments will be added)
    • Rest of parameters: select issue link types, issue types, etc. according to the linked issue you want to copy the comment to.

    Important Note: due to a bug in JIRA you will need to use TEXT workflow edition mode to add post-function to global reflexive transitions.

    4) Create a rule for JIRA Automation Plugin for executing "Clone Last Comment" each time a comment is added to your source issue type.

    5) Create a rule for JIRA Automation Plugin for executing "Clone Attachments" each time an attachment is added to your source issue type.

    You can create automation rules at: Administation > Add-ons > Automation > Add Rule

  12. Shai Dahan Account Deactivated reporter

    Thank you Fidel,

    I've literally almost done the same thing a wee ago.

    The only different that I've created a reflexive transition for every status instead of creating a global one - thank you for educate me differently :)

    I've also had to create a separate rule for each status (a bit of a hard work...) - but it works and it is doing the job.

    Thank you for following up and come up with a solution, which I think will be implemented as it much cleaner than mien.

  13. Shai Dahan Account Deactivated reporter

    I have one question though; when you clone an attachment, what should be the issue trigger in the automation rule?

    In comment, you put "Issue Commented" as issue event, but in attachment, there isn't any special even which is being triggered.

  14. Fidel Castro Armario repo owner

    I didn't realize that there isn't any specific event for attachment updates. The only ideas I can give you are:

    1. To use "Issue updated" event. The problem is that "Clone Attachments" transition will be executed many times, and it might penalize performance.
    2. To execute the transition as a scheduled task, e.g, you can set a rule for executing that transition twice a day, in order to synchronize attachments. The problem is that you don't have a real-time attachments synchronization.
  15. Shai Dahan Account Deactivated reporter

    Ok thanks, I thought that that there isn't any specific event for attachment. Anyway I can live with only "Issue commented" type of event.

    I've implemented your suggestion to create a global reflection (which is much better than to do it on each status in the workflow) and I've insert both post functions in the same transition.

    (I can only hope that the user will place the attachment and then make a comment and not the other way around)

    This transition clone both attachments and comment.

    Automation rule is waiting for a comment to trigger the transition.

    It works well so far so you can close the ticket at your end.

    Thank you again for all your support :)

    Shai

  16. Log in to comment