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

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

Avatar

1 badge earned

Collect

Participate in fun challenges

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

Challenges
Coins

Gift kudos to your peers

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

Recognition
Ribbon

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!

Leaderboard

Copied custom field doesn't show up in search issue navigation when filtered by it.

Edited

I have a custom field(not script field) 'Team'. I created another custom field 'teamCopy' and used the below script to copy values of 'Team' to 'copyTeam'. It worked. When I go to issue navigation, 'copyTeam' custom field shows the values are copied successfully but when I filter the search with a 'copyTeam' value it doesn't show any result. What am I missing?

the goal is to go to issue nagivation and filter by 'teamCopy' value e.g. CRC.360 and get the result which I'm not getting but without filter the teamCopy Column shows the copied values.

Here is the code. I ran the script in script runner script console.

import com.atlassian.jira.CompomemtManager;
import com.atlassian.jira.issue.CustomManager;
import com.atlassian.jira.fields.CustomId;
import com.atlassian.jira.component.ComponentAccessor;
import com.atlassian.jira.issue.ModifiedValue;
import com.atlassian.jira.issue.utilDefaultIssueChangeHolder;
import com.atlassian.jira.MutableIssue
import com.atlassian.jira.search.SearchProvider;
import com.atlassian.jira.jql.parser.JqlQueryParser;
import com.atlassian.jira.web.bean.PagerFilter;
import com.atlassian.jira.event.type.EventDispatchOption
import java.sql.Timestamp;

def jqlQueryParser = ComponentAccessor.getComponent(JqlQueryParser.class)
def searchProvider = ComponentAccessor.getComponent(SearchProvider.class)
def issueManager = ComponentAccessor.getIssueManager()
der user = ComponentAccessor.getJiraAuthenticationContext().getLoggedInUser()
def query = jqlQueryParser.parseQuery('Team is not empty')
def results = searchProvider.search(query, user, PagerFilter.getUnlimitedFilter())

results.getIssue().each{documentation ->;
MutableIssue issue = issueManager.getIssueObject(documentIssue.id)
log.setLevel(org.apache.log4j.Level.DEBUG)
//this is team object
def field_pp = ComponentAccessor.getCustomFieldManager().getCustomFieldObjectByName('Team')
def ppText = issue.getCustomFieldValue(field_pp).toString();
log.debug("teamval :${ppText}");
//this is teamCopy object
def field_se = ComponentAccessor.getCustomFieldManager().getCustomFieldObjectByName('teamCopy')
def seText = issue.getCustomFieldValue(field_se);

field_se.updateValue(null, issue, new ModifiedValue(seText, ppText), new DefaultIssueChangeHolder());
log.debug("teamval :${seText}");

issueManager.updateIssue(user, issue, EventDispatchOption.ISSUE_UPDATED,false);
issue.setUpdated(new Timestamp(System.currentTimeMillis()));
}



 

0 comments

Comment

Log in or Sign up to comment