Groovy, how to get connection-information

Originally asked by Adrian Suter on 04 December 2020 (original question)


I like to implement some logging information in the connection-rules. As example, I have the following working example (Jira Server and Exalate 5.0.4-j8):

def allowedIssueTypes = ['Task', 'Story', 'Bug']
log.warn("Check for valid Issue-Types = " + replica.type?.name)
if (!allowedIssueTypes.contains(replica.type.name)) {
	log.warn("Check for valid Issue-Types : Issue-Type = " + replica.type.name + "is not allowed. The issue with key " + replica.key + " will not be synchronized to hosting-zone. Check the trigger, the issue type should be excluded from synch trigger !")
return
}

I couldn’t find a script-helper or other information, how to access the connection-information. I like to add the current connection name to the log-message. How can I do that ?

Thanks
Adrian Suter


Answer by Adrian Suter on 08 December 2020

Hello Mariia,

i can find a lot of those objects at https://docs.idalko.com/exalate/display/ED/Issue+fields+available+for+synchronization. But i couldn’t find a list of the object types like “connection”.

Do you have a link for me what kind of objects i can access from groovy within the outgoing and incoming rules ?

Thanks

Adrian


Answer by Mariia Horbatiuk on 07 December 2020

Hello Adrian,

Current connection name is an object, so you can use

connection.name 

This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.