Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

Earn badges and make progress

You're on your way to the next level! Join the Kudos program to earn points and save your progress.

Deleted user Avatar
Deleted user

Level 1: Seed

25 / 150 points

Next: Root


1 badge earned


Participate in fun challenges

Challenges come and go, but your rewards stay with you. Do more to earn more!


Gift kudos to your peers

What goes around comes around! Share the love by gifting kudos to your peers.


Rise up in the ranks

Keep earning points to reach the top of the leaderboard. It resets every quarter so you always have a chance!


Come for the products,
stay for the community

The Atlassian Community can help you and your team get more value out of Atlassian products and practices.

Atlassian Community about banner
Community Members
Community Events
Community Groups

Problem with groovy and postfunction


we have a groovy, that do not work from several weeks:

import com.atlassian.jira.issue.fields.CustomField;

import com.atlassian.jira.issue.CustomFieldManager;

import com.atlassian.jira.component.ComponentAccessor;

import com.atlassian.jira.user.util.UserManager;

import com.atlassian.jira.user.ApplicationUser;

import com.atlassian.jira.user.ApplicationUser;

import com.atlassian.jira.issue.util.DefaultIssueChangeHolder;

import com.atlassian.jira.issue.util.IssueChangeHolder;

import com.atlassian.jira.issue.ModifiedValue;

import com.atlassian.jira.issue.customfields.manager.OptionsManager;


CustomFieldManager customFieldManager = ComponentAccessor.getCustomFieldManager();

IssueChangeHolder changeHolder = new DefaultIssueChangeHolder();


def userManager = ComponentAccessor.getUserManager();

def issueManager = ComponentAccessor.getIssueManager();


def jobInterviewerICSD = customFieldManager.getCustomFieldObjectByName("Job Interviewer I CSD");

def jobInterviewerIPBS = customFieldManager.getCustomFieldObjectByName("Job Interviewer I PBS");


CustomField privilegesField = customFieldManager.getCustomFieldObjectByName("Access privileges");


if(jobInterviewerICSD != null){

               ModifiedValue newPrivilegesField = new ModifiedValue(issue.getCustomFieldValue(privilegesField), jobInterviewerICSD);

               privilegesField.updateValue(null, issue, newPrivilegesField, new DefaultIssueChangeHolder());

               return privilegesField;



if(jobInterviewerIPBS != null){

               ModifiedValue newPrivilegesField = new ModifiedValue(issue.getCustomFieldValue(privilegesField), jobInterviewerIPBS);

               privilegesField.updateValue(null, issue, newPrivilegesField, new DefaultIssueChangeHolder());

               return privilegesField;



The postfunction error shows:



2018-06-15 11:46:45,266 ERROR [workflow.ScriptWorkflowFunction]: *************************************************************************************

2018-06-15 11:46:45,267 ERROR [workflow.ScriptWorkflowFunction]: Script function failed on issue: REC-19463, actionId: 891, file: /var/atlassian/application-data/jira/scripts/GroovyScripts/recruitnsc/scripts/set_access_privileges.groovy

java.lang.ClassCastException: com.atlassian.jira.issue.fields.ImmutableCustomField cannot be cast to java.util.Collection

      at com.atlassian.jira.issue.customfields.impl.AbstractMultiCFType.createValue(

      at com.atlassian.jira.issue.fields.ImmutableCustomField.createValue(

      at com.atlassian.jira.issue.fields.ImmutableCustomField.updateValue(

      at com.atlassian.jira.issue.fields.ImmutableCustomField.updateValue(

      at com.atlassian.jira.issue.fields.OrderableField$ Source)


Do you see any possible errors?


Thank you

1 answer

0 votes
Alejandro Suárez
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
Jun 18, 2018

There are several incorrect or improvable things in that script. What are you trying to do here?

Suggest an answer

Log in or Sign up to answer
AUG Leaders

Atlassian Community Events