I was trying to use singleline_field.updateValue(null, issue, new ModifiedValue("", (Object) desiredValue), new DefaultIssueChangeHolder()) and issue.setCustomFieldValue(singleline_field, "desiredValue") - both functions do not seem to work if target field is hidden on the screen (this is mandatory because readonly custom fields do not exist in Jira).
Also I'm getting an error below when trying to update Multiple Users field value with array of users
Script function failed on event: com.atlassian.jira.event.issue.IssueEvent, file: <inline script>
java.lang.ClassCastException: com.atlassian.jira.user.DelegatingApplicationUser cannot be cast to com.riadalabs.jira.plugins.insight.services.model.ObjectBean
What are possible solutions?