Hi All,
I need to compare 2 custom field values
Field 1 is a multi select list field containing name of users in a string format.
Field 2 is derived from below script( which is the display name of the logged in user in jira)
def currentUser = ComponentAccessor.getJiraAuthenticationContext().getLoggedInUser()
String currUserFullName = currentUser.getDisplayName();
log.error("User: $currUserFullName")
Now I need to compare above value to all the values in the multiselect field value. Is it possible?
I started building a script but not able to complete it , please assist:
Summary: Current logged in user needs to be compared to Field 1( multi select) selection
Here is a complete code for what you are looking:
import com.atlassian.jira.component.ComponentAccessor
import com.atlassian.jira.issue.CustomFieldManager
def currentUser = ComponentAccessor.getJiraAuthenticationContext().getLoggedInUser()
CustomFieldManager customFieldManager = ComponentAccessor.getCustomFieldManager()
def cfMultiSelectUser = customFieldManager.getCustomFieldObjectByName("name of your field")
def users = issue.getCustomFieldValue(cfMultiSelectUser)
for (int i = 0; i < users.size(); i++) {
if (users.get(i).equals(currentUser)) {
/*if current user exist in the multi user picker list value
do here what ever you want*/
}
}
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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.