The Atlassian Community Forums are currently in read-only mode. We will be relaunching on a new platform on September 22 (read more here). We apologize for the extended downtime. For concerns or questions, please email communitymanagers@atlassian.com. See you on the other side, on the new Atlassian Community Forums! :)

×

Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

Facing "Unsupported type class java.util.LinkedHashMap in setFieldOptions()" error

Richa Rajaram Aware
August 2, 2024

We have request like we need to pop the users from specific user group in "User Picker (Single User)" field based on the another drop down fields option. So I have tried it with below script but getting  "Unsupported type class java.util.LinkedHashMap in setFieldOptions()" error while executing it. 

 

 

import com.atlassian.jira.component.ComponentAccessor
 
def userUtil = ComponentAccessor.getUserUtil()
def currentUser = ComponentAccessor.getJiraAuthenticationContext().getLoggedInUser()
def userManager = ComponentAccessor.getUserManager()
def groupManager = ComponentAccessor.getGroupManager()
 
// def field = getFieldById("customfield_36450")
// Get the form fields
def regardingField = getFieldById("customfield_27500") // The field to check
def userPickerField = getFieldById("customfield_35100") // The user picker field
// Get the value of the regarding field
def regardingValue = regardingField.getValue()


// Check the value and restrict the user picker field based on the group
if (regardingValue == "AUTO AD") {
    def group = groupManager.getGroup("MU Tech_Auto AD")
   
    def groupMembers = groupManager.getUsersInGroup(group)
   
    def userOptions = groupMembers.collect { [id: it.key, name: it.displayName] }
    userPickerField.setFieldOptions(userOptions)
   
} else {
    userPickerField.setFieldOptions([]) // Or some default options
}
We are using Jira Data Center Version 8.20.30
Please check and support me while resolving this error.
Thank You!
Best Regards,
Richa Aware

1 answer

Comments for this post are closed

Community moderators have prevented the ability to post new answers.

0 votes
Richa Rajaram Aware
August 7, 2024

Hello, 

Is there any update for above request?

 

Best Regards,
Richa Aware