How to unexalate specific connection with custom field condition

Originally asked by Salma Nairi on 24 September 2021 (original question)


Hi

we need to unexalate specific connection with custom field condition

if local issue has customfield value equal to “Shynchro Stopped” , unexalate this issue

if remote issue has more than one connection , we need to keep them and unexalte only a specific connection

Thanks


Comments:

Salma Nairi commented on 27 September 2021

i tried this code but it didn’t work

Does the exalate support to unexalate the connected issue auto for specified connection when I close the issue? (old community)

Daniel Carvajal commented on 01 October 2021

Hi Salma Nairi

We are working to find a solution to this problem, we will be replying soon.

Thanks

Salma Nairi commented on 01 October 2021

Daniel Carvajal , thanks

Ariel Aguilar commented on 01 October 2021

Hi Salma,

The following article was updated since the method changed:

https://docs.idalko.com/exalate/x/IZArAQ

This should work to get the value from the custom field, and unexalate for all connections:

if (replica.customFields."Custom Field".value == "Shynchro Stopped"){
      final def _syncInitService = com.atlassian.jira.component.ComponentAccessor
            .getOSGiComponentInstanceOfType(com.exalate.api.trigger.ISyncInitiationService.class)
    _syncInitService.unexalate(issueKey.id as String)
        return
}

Then if you want to do it by single connection, you might want to think on using scriptrunner and check this post:

Unexalate connection via scriptrunner (old community)

Kind regards,

Ariel

Salma Nairi commented on 02 October 2021

Thanks

i already tried using script runner but i had exceptions some methods can’t be imported

I did not find the time to solve them  
thanks