When you do a GET on an issue containing insight custom field value it will return an array of values like this [“My object (thekey-123)“,”My other object (thekey-456)”] to extract the key from that use a groovy variable with the lines below. It will return thekey-123 and thekey-456
def regexp = /\(([^\)]+)\)/
def matcher = response =~ regexp
return matcher.getAt(0)[1]