Working with label text

Originally asked by Glenn Bullingham on 17 March 2020 (original question)


Trying to add the value of each incoming label (from GitHub) to a Jira custom field, which is a multi-line text box. Objective is to display one label per line.

However the items of the replica.issues array do not appear to implement properties or operators required for string operations:

“No signature of method: com.exalate.basic.domain.hubobject.v1.BasicHubCustomField.append() is applicable for argument types: (com.exalate.basic.domain.hubobject.v1.BasicHubLabel)”

Whether I iterate the label collection directly (for loop) or use the Groovy .collect() method, the result is the same. A single label instance cannot be directly assigned to a text field, and properties such as ‘value’ aren’t implemented.

Given a single label instance from the replica.labels collection, how do I get the label text as a string type?
Source: Jira Cloud (old community)


Answer by Juan Grases on 17 March 2020

Hi Glenn,

This on your incoming sync on Jira Cloud should work:

issue.customFields."Jira Text Field".value = replica.labels.label.join("\n")

Best regards,

Juan


Comments:

Glenn Bullingham commented on 18 March 2020

Hi Juan,

Thank you for you assistance, it does indeed work.

Best regards,

Glenn

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