Hi Community,
I am trying to fill in Insight object(s) custom field, which is configured as multiple.
Here is the code:
if (members != null)
{
for (item in members)
{
def userInsightField = customFieldManager.getCustomFieldObject("customfield_11525") // TSO members (Insight)
Class iqlFacadeClass = ComponentAccessor.getPluginAccessor().getClassLoader().findClass("com.riadalabs.jira.plugins.insight.channel.external.api.facade.IQLFacade")
def iqlFacade = ComponentAccessor.getOSGiComponentInstanceOfType(iqlFacadeClass)
def member = iqlFacade.findObjectsByIQLAndSchema(3,"\"User Jira Key\" = " + item.key) // Schema 3 = Customer Directory
if (issue.getCustomFieldValue(userInsightField) == null)
{userInsightField.updateValue(null, issue, new ModifiedValue(issue.getCustomFieldValue(userInsightField), member), changeHolder)}
else
{userInsightField.updateValue(null, issue, new ModifiedValue(issue.getCustomFieldValue(userInsightField), issue.getCustomFieldValue(userInsightField) + member), changeHolder)}
//return issue.getCustomFieldValue(userInsightField)
}
}
In members, there is an ArrayList of DelegatingApplicationUser
In the return section, I am getting two objects
When executed in post function, only one object is in the field.
Was search for solution for hours, but no success, please, help me out :-)