I've got a doozy of an ask here and I'm pretty lost as to how to handle it.
We have a project dedicated to release tickets. We link all of the tickets going into a release to a ticket within the release project, issuekey CC-#### (referred to as a CC ticket from hereafter).
I'm trying to accomplish the following:
WHEN an issue is linked to a CC ticket OR an issue link is deleted from a CC ticket
1) Clear the custom field "Components Global" (a multi-select field) on the CC ticket
2) Query the data for "Components Global" on all linked tickets (stories, bugs, etc.)
3) Add all data for "Components Global" from all linked tickets to "Components Global" on the CC ticket
In other words, whenever a link is created, I want to clear this custom field and re-complete it with every item in the matching field from all linked tickets.
I've managed to set up a simpler version where any time a ticket is linked using a custom link type, that ticket's "Components Global" data is added to the CC ticket. However, this will not serve to remove components when a ticket is pulled from a release. Because multiple stories may use the same component, I can't simply perform the reverse action of automatically removing any components from the unlinked ticket.
Because I realize this may seem convoluted, here's an example:
CC-1234 has no linked tickets. Components Global is blank.
Ticket DEV-1111 is added and has values "A, B, C" in "Components Global". The rule should add "A, B, C" to the field on CC-1234.
Now, we're linking DEV-2222 and it has "C, D, E" in "Components Global". The rule should add "D, E" to the field on CC-1234, because it already had "C".
If we were to remove the link from DEV-1111, I need values "A, B" to be removed from "Components Global", but not "C", because it exists on DEV-2222.
So, in my mind, the cleanest solution is to clear "Components Global" every time and dump all the compiled linked ticket data into it.
I've been slowly diving deeper into rabbit holes of web hooks and JSON and plenty else I don't understand. I have the custom field id (10568) and # ("customfield_10297"). Help!