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

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

Custom field updating error (Script runner)

Hi all, 

I have a custom field (cuscading select) and when i do update its sometime change value but sometime dont change. I do it with this code:

def muIssue;
def commentManager = ComponentAccessor.getCommentManager();
def issueManager = ComponentAccessor.getIssueManager();
def issue = event.getIssue()
def issueKey = issue.getProjectObject().getOriginalKey()
def catApp = issue.getCustomFieldValue(com.atlassian.jira.component.ComponentAccessor.getCustomFieldManager().getCustomFieldObjectByName("field 1")).toString()
def catApp1 = issue.getCustomFieldValue(com.atlassian.jira.component.ComponentAccessor.getCustomFieldManager().getCustomFieldObjectByName("field2")).toString()
def catSupObject = ComponentAccessor.getCustomFieldManager().getCustomFieldObjectByName("field3")
def issueManager1 = ComponentAccessor.getIssueManager()
def issueIndexingService = ComponentAccessor.getComponent(IssueIndexingService)
def issueType = issue.getIssueType().getName()
def issueService = ComponentAccessor.getIssueService()
def linkType = ["link type"]
def linkMgr = ComponentAccessor.getIssueLinkManager()
for (IssueLink link in linkMgr.getOutwardLinks( {
def destIssue = link.getDestinationObject()
if (linkType.contains( {
muIssue = issueManager.getIssueObject(destIssue.getId())
OptionsManager optionsManager = (OptionsManager)ComponentManager.getComponentInstanceOfType(OptionsManager.class); Object cValue = catSupObject.getValue(muIssue)
Map<String,Object>newValues = new HashMap<String, Object>();
Long parrentID = 20893
Long childID = 20895
def parentOptionObj = optionsManager.findByOptionId(parrentID)
def childOptionObj = optionsManager.findByOptionId(childID)
newValues.put(null, parentOptionObj)
newValues.put("1", childOptionObj)
catSupObject.updateValue(null, muIssue, new ModifiedValue(cValue, newValues), new DefaultIssueChangeHolder());


Maybe somebody know how to fix it? 

0 answers

Suggest an answer

Log in or Sign up to answer
Community showcase
Posted in Trello

Taco Tuesday: Your favorite Trello blog takeaway

Hello friends! From the community that brought you Welcome Wednesday, Throwback Thursday and Friday Fun, welcome to Taco Tuesday, a weekly discussion about all things Trello. The best part? One Tac...

82 views 6 5
Join discussion

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