Showing results for 
Search instead for 
Did you mean: 
Sign up Log in
Deleted user
0 / 0 points
badges earned

Your Points Tracker
  • Global
  • Feed

Badge for your thoughts?

You're enrolled in our new beta rewards program. Join our group to get the inside scoop and share your feedback.

Join group
Give the gift of kudos
You have 0 kudos available to give
Who do you want to recognize?
Why do you want to recognize them?
Great job appreciating your peers!
Check back soon to give more kudos.

Past Kudos Given
No kudos given
You haven't given any kudos yet. Share the love above and you'll see it here.

It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

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

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
Community showcase
Published in Marketplace Apps & Integrations

Staying organized with Jira: best practices for a better project management

Project managers know this problem: A “mountain of work” lays in front of you, and you don’t know how and where to tackle them. Different to-dos lie ahead, but just one task after the other can be ha...

183 views 2 1
Read article

Community Events

Connect with like-minded Atlassian users at free events near you!

Find an event

Connect with like-minded Atlassian users at free events near you!

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you