error copy date value to another date CF in groovy script

Hi

i need  script that copy date value from c

customfield_10408

to

customfield_10500

 .

i try with below script but not worked and when execute transition (behind is script post function) error showed.

 

import java.util.*
import com.atlassian.jira.issue.Issue
import com.atlassian.jira.component.ComponentAccessor
import com.atlassian.jira.issue.fields.CustomField
import com.atlassian.jira.ComponentManager
import com.atlassian.jira.issue.CustomFieldManager
import static java.lang.Math.*
import java.sql.Timestamp
 
def customFieldManager = ComponentAccessor.getCustomFieldManager()
def customField = customFieldManager.getCustomFieldObject("customfield_10408")
def customFieldtemp = customFieldManager.getCustomFieldObject("customfield_10500")

issue.setCustomFieldValue(customField, customFieldtemp)

error:

Error occurred while creating issue. This could be due to a plugin being incompatible with this version of JIRA. For more details please consult the logs, and see: http://confluence.atlassian.com/x/3McB com.atlassian.jira.issue.fields.ImmutableCustomField cannot be cast to java.util.Date

1 answer

1 accepted

You can find a ton of solution proposal on this site. https://answers.atlassian.com/questions/44079143 your code dont seem to set any value based on any field at the moment. 

Suggest an answer

Log in or Sign up to answer
How to earn badges on the Atlassian Community

How to earn badges on the Atlassian Community

Badges are a great way to show off community activity, whether you’re a newbie or a Champion.

Learn more
Community showcase
Published yesterday in Jira

5 ways you can make the most of Jira Software and Bitbucket Cloud

As part of the Bitbucket product team I'm always interested in better understanding what kind of impact the use of our tools have on the way you work. In a recent study we conducted of software devel...

53 views 0 5
Read article

Atlassian User Groups

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

Find a group

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

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you