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(issue.id)) {
def destIssue = link.getDestinationObject()
if (linkType.contains(link.issueLinkType.name)) {
muIssue = issueManager.getIssueObject(destIssue.getId())
log.warn(issue.equals(destIssue))
if(!issue.equals(destIssue)){
OptionsManager optionsManager = (OptionsManager)ComponentManager.getComponentInstanceOfType(OptionsManager.class); Object cValue = catSupObject.getValue(muIssue)
if(issueType.equals("xxx")&&catApp.equals("yyy")){
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());
}
}
}
}
issueIndexingService.reIndex(issueManager.getIssueObject(muIssue.id));
Maybe somebody know how to fix it?
Online forums and learning are now in one easy-to-use experience.
By continuing, you accept the updated Community Terms of Use and acknowledge the Privacy Policy. Your public name, photo, and achievements may be publicly visible and available in search engines.