Hi,
I have a Scripted field whose template is "User Picker (multiple users".
I have the following script written, but the script is still not loading the field. Can you help?
----
import com.atlassian.jira.component.ComponentAccessor
import groovy.sql.Sql
import org.ofbiz.core.entity.ConnectionFactory
import org.ofbiz.core.entity.DelegatorInterface
import com.atlassian.jira.user.ApplicationUserimport com.atlassian.jira.issue.fields.CustomField
import com.atlassian.jira.issue.MutableIssue;
import java.util.*import com.atlassian.jira.user.util.UserUtil;
import com.atlassian.jira.user.util.UserManager;import java.sql.Connection
def delegator = (DelegatorInterface) ComponentAccessor.getComponent(DelegatorInterface)
String helperName = delegator.getGroupHelperName("default");log.error "Good so far 0";
def sqlStmt = """
SELECT bizuser
FROM <myschema>.jbizusers
where <myschema>.jbizusers.jissue=\'""" + issue.getKey() + "\'";log.error "Good so far 1"
Connection conn = ConnectionFactory.getConnection(helperName);
Sql sql = new Sql(conn);
String user = null;log.error "Good so far 2";
UserUtil userUtil = ComponentAccessor.getUserUtil();
UserManager userManager = ComponentAccessor.getUserManager();
ApplicationUser jiraUser = null;
List<ApplicationUser> jiraUsers = [];try {
StringBuffer sb = new StringBuffer();
log.error "Good so far 3";
sql.eachRow(sqlStmt) { row ->
user = "$row.bizuser";
log.error "USER: " + user;
jiraUser = userManager.getUserByName(user);
jiraUsers.add(jiraUser);
//users.add(jiraUser)
}
}
finally {
sql.close()
}log.error "Good so far 4"
log.error "JiraUsers size: " + jiraUsers.size()
return jiraUsers
The Preview for any issue shows the output correctly, with the Application Users identified.
However, the corresponding scripted field is not getting loaded for the same issue.
Any inputs, thanks!
@Ambica Seshasayee - Did you happen to find a solution for this? I am having the same issue. The preview works fine, but nothing is visible on the issue screen.
Online forums and learning are now in one easy-to-use experience.
By continuing, you accept the updated Community Terms of Use and acknowledge the Privacy Policy. Your public name, photo, and achievements may be publicly visible and available in search engines.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.