2 answers
- 210
Hi Marika,
I have tested this approach out so I can finally give you a concrete answer.
Keep in mind that this will only work if your options for the Single Select Custom Field match with the names of the components on the destination side:
Make sure to change "Select List Test" to the actual name of your custom Field on both sides
Outgoing (source side):
replica.customFields."Select List Test" = issue.customFields."Select List Test"
Incoming (destination side):
def selectListOption = replica.customFields."Select List Test"?.value.value def component = nodeHelper.getComponent(selectListOption, nodeHelper.getProject(issue.projectKey)) issue.components += component
Thanks,
André
CommentAdd your comment... - 10-1
Hello,
I tried in incoming rule as belowif(firstSync){ // If it's the first sync for an issue (local issue does not exist yet) // Set project key from source issue, if not found set a default //issue.projectKey = nodeHelper.getProject(replica.project?.key)?.key ?: "TEST" //issue.projectKey = replica.customFields."Autoliv Partner"?.value?.value // issue.projectKey = replica.components.collect(it.name) //issue.projectKey = replica.components.collect { remoteComponent -> // nodeHelper.getComponent( remoteComponent.name) } // Set type name from source issue, if not found set a default // issue.typeName = nodeHelper.getIssueType(replica.type?.name, issue.projectKey)?.name ?: "Task" def componentNameToProjectMap = ["Ansible Automation Project":"ANSIBLE","Change Dashboard":"CHD"] issue.projectKey = replica.components.collect { component -> componentNameToProjectMap[component.name] }.find{it != null} ?: "STTEST" syncHelper.syncBackAfterProcessing() issue.type = replica.type def selectListOption = replica.customFields."JIRA Component"?.value.value def component = nodeHelper.getComponent(selectListOption, nodeHelper.getProject(issue.projectKey)) issue.components += component }
I got the below error:
Error Type: Incoming sync: first sync error Error Creation Time: 2020-12-03 11:51:02.073 Error Detail Message: Script error details: No signature of method: com.exalate.node.hubobject.v1_3.NodeHelper.getComponent() is applicable for argument types: ([C, com.exalate.basic.domain.hubobject.v1.BasicHubProject) values: [TC2, com.exalate.basic.domain.hubobject.v1.BasicHubProject@74809f4f] Possible solutions: getComponent(java.lang.String), getComponent(java.lang.String, com.exalate.api.domain.hubobject.v1_2.IHubProject). Error line: Script23.groovy:16 Error Stack Trace com.exalate.api.exception.script.CreateProcessorException: Script error details: No signature of method: com.exalate.node.hubobject.v1_3.NodeHelper.getComponent() is applicable for argument types: ([C, com.exalate.basic.domain.hubobject.v1.BasicHubProject) values: [TC2, com.exalate.basic.domain.hubobject.v1.BasicHubProject@74809f4f] Possible solutions: getComponent(java.lang.String), getComponent(java.lang.String, com.exalate.api.domain.hubobject.v1_2.IHubProject). Error line: Script23.groovy:16 at com.exalate.error.services.ScriptExceptionCategoryService$.wrapAsCreateProcessorException(ScriptExceptionCategoryService.scala:54) at com.exalate.processor.jira.JiraCreateIssueProcessor.createIssue(JiraCreateIssueProcessor.java:163) at com.exalate.replication.request.CreateIssueSyncRequestState.transition(CreateIssueSyncRequestState.java:73) at com.exalate.replication.request.CreateIssueSyncRequestState.transition(CreateIssueSyncRequestState.java:24) at com.exalate.replication.in.RequestProcessorService.processSyncRequest(RequestProcessorService.java:324) at com.exalate.replication.in.RequestProcessorService.processSyncRequestsForIssue(RequestProcessorService.java:194) at com.exalate.replication.in.RequestProcessorService.processSyncRequests(RequestProcessorService.java:131) at com.exalate.replication.in.RequestWorker$1.run(RequestWorker.java:91) at com.exalate.node.util.concurrent.ClusteredSensitiveExecutorService$1.run(ClusteredSensitiveExecutorService.java:32) at com.exalate.node.util.concurrent.ClusteredSensitiveExecutorService$1.run(ClusteredSensitiveExecutorService.java:28) at com.exalate.node.util.concurrent.ClusteredSensitiveExecutorService.executeHandlingLocks(ClusteredSensitiveExecutorService.java:54) at com.exalate.node.util.concurrent.ClusteredSensitiveExecutorService.executeHandlingLocks(ClusteredSensitiveExecutorService.java:28) at com.exalate.replication.in.RequestWorker.run(RequestWorker.java:81) at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511) at java.util.concurrent.FutureTask.runAndReset(FutureTask.java:308) at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$301(ScheduledThreadPoolExecutor.java:180) at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:294) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) at java.lang.Thread.run(Thread.java:748) Caused by: com.exalate.api.exception.script.ScriptException: No signature of method: com.exalate.node.hubobject.v1_3.NodeHelper.getComponent() is applicable for argument types: ([C, com.exalate.basic.domain.hubobject.v1.BasicHubProject) values: [TC2, com.exalate.basic.domain.hubobject.v1.BasicHubProject@74809f4f] Possible solutions: getComponent(java.lang.String), getComponent(java.lang.String, com.exalate.api.domain.hubobject.v1_2.IHubProject). Error line: Script23.groovy:16 at com.exalate.error.services.ScriptExceptionCategoryService.categorizeProcessorAndIssueTrackerExceptionsIntoScriptExceptions(ScriptExceptionCategoryService.scala:36) at com.exalate.processor.ExalateProcessor.executeProcessor(ExalateProcessor.java:48) at com.exalate.processor.jira.JiraCreateIssueProcessor.executeCreateProcessor(JiraCreateIssueProcessor.java:291) at com.exalate.processor.jira.JiraCreateIssueProcessor.createIssue(JiraCreateIssueProcessor.java:145) ... 18 more Caused by: javax.script.ScriptException: javax.script.ScriptException: groovy.lang.MissingMethodException: No signature of method: com.exalate.node.hubobject.v1_3.NodeHelper.getComponent() is applicable for argument types: ([C, com.exalate.basic.domain.hubobject.v1.BasicHubProject) values: [TC2, com.exalate.basic.domain.hubobject.v1.BasicHubProject@74809f4f] Possible solutions: getComponent(java.lang.String), getComponent(java.lang.String, com.exalate.api.domain.hubobject.v1_2.IHubProject) at org.codehaus.groovy.jsr223.GroovyScriptEngineImpl.eval(GroovyScriptEngineImpl.java:151) at javax.script.AbstractScriptEngine.eval(AbstractScriptEngine.java:264) at com.exalate.processor.ExalateProcessor.execute(ExalateProcessor.java:73) at com.exalate.processor.ExalateProcessor.executeProcessor(ExalateProcessor.java:46) ... 20 more Caused by: javax.script.ScriptException: groovy.lang.MissingMethodException: No signature of method: com.exalate.node.hubobject.v1_3.NodeHelper.getComponent() is applicable for argument types: ([C, com.exalate.basic.domain.hubobject.v1.BasicHubProject) values: [TC2, com.exalate.basic.domain.hubobject.v1.BasicHubProject@74809f4f] Possible solutions: getComponent(java.lang.String), getComponent(java.lang.String, com.exalate.api.domain.hubobject.v1_2.IHubProject) at org.codehaus.groovy.jsr223.GroovyScriptEngineImpl.eval(GroovyScriptEngineImpl.java:348) at org.codehaus.groovy.jsr223.GroovyScriptEngineImpl.eval(GroovyScriptEngineImpl.java:145) ... 23 more Caused by: groovy.lang.MissingMethodException: No signature of method: com.exalate.node.hubobject.v1_3.NodeHelper.getComponent() is applicable for argument types: ([C, com.exalate.basic.domain.hubobject.v1.BasicHubProject) values: [TC2, com.exalate.basic.domain.hubobject.v1.BasicHubProject@74809f4f] Possible solutions: getComponent(java.lang.String), getComponent(java.lang.String, com.exalate.api.domain.hubobject.v1_2.IHubProject) at org.codehaus.groovy.runtime.ScriptBytecodeAdapter.unwrap(ScriptBytecodeAdapter.java:56) at org.codehaus.groovy.runtime.callsite.PojoMetaClassSite.call(PojoMetaClassSite.java:46) at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:45) at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:108) at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:120) at Script23.run(Script23.groovy:16) at org.codehaus.groovy.jsr223.GroovyScriptEngineImpl.eval(GroovyScriptEngineImpl.java:345) ... 24 more
Can you please advise ?
- Mariia Horbatiuk
Hello Sam,
Can you please let me know if "Jira Component" CF is a multiple option CF?
If that's the case, please try the following:
def selectListOption = replica.customFields."JIRA Component"?.value.value?.find()
- Sam
we usually have a single component for the Sync, shall I try suggested statement in target JIRA server ?
- Juan Grases
Hi Sam,
Your code indicates that you are using a custom field on the source side (JIRA Component), what would be it's type? We are trying to understand why your code didn't work, as it should work fine in the case that custom field "Jira Component" is of type Single Select List
Thanks,
Juan
- Sam
Hello Juan,
The JIRA Component custom field is from the type:
Text Field (single line) Thanks
Sam
- Juan Grases
In that case, could you try this line:
def selectListOption = replica.customFields."JIRA Component"?.value
And let me know if it works.
- Sam
Hello Juan,
I got the below error:
Error Detail Message: Exalate has problems while trying to create an issue in this Jira. Details: [InvalidInputException: [Error map: [{components=Component/s is required.}]] [Error list: [[]]] Error Stack Trace com.exalate.api.exception.IssueTrackerException: Exalate has problems while trying to create an issue in this Jira. Details: [InvalidInputException: [Error map: [{components=Component/s is required.}]] [Error list: [[]]] at com.exalate.node.compatibility.CompatibilityService.createIssueObject(CompatibilityService.java:657) at com.exalate.node.hubobject.v1_4.NodeHubIssueHelper.createIssue(NodeHubIssueHelper.java:541) at com.exalate.node.hubobject.v1_4.NodeHubIssueHelper.createIssueWith(NodeHubIssueHelper.java:458) at com.exalate.compatibility.HubObjectHelperAdapter.createNodeIssueWith(HubObjectHelperAdapter.java:42) at com.exalate.hubobject.v1_2.HubObjectHelper.createNodeIssueWith(HubObjectHelper.java:316) at com.exalate.processor.jira.JiraCreateIssueProcessor.applyProcessorResult(JiraCreateIssueProcessor.java:358) at com.exalate.processor.jira.JiraCreateIssueProcessor.applyProcessorResult(JiraCreateIssueProcessor.java:334) at com.exalate.processor.jira.JiraCreateIssueProcessor.createIssue(JiraCreateIssueProcessor.java:160) at com.exalate.replication.request.CreateIssueSyncRequestState.transition(CreateIssueSyncRequestState.java:73) at com.exalate.replication.request.CreateIssueSyncRequestState.transition(CreateIssueSyncRequestState.java:24) at com.exalate.replication.in.RequestProcessorService.processSyncRequest(RequestProcessorService.java:324) at com.exalate.replication.in.RequestProcessorService.processSyncRequestsForIssue(RequestProcessorService.java:194) at com.exalate.replication.in.RequestProcessorService.processSyncRequests(RequestProcessorService.java:131) at com.exalate.replication.in.RequestWorker$1.run(RequestWorker.java:91) at com.exalate.node.util.concurrent.ClusteredSensitiveExecutorService$1.run(ClusteredSensitiveExecutorService.java:32) at com.exalate.node.util.concurrent.ClusteredSensitiveExecutorService$1.run(ClusteredSensitiveExecutorService.java:28) at com.exalate.node.util.concurrent.ClusteredSensitiveExecutorService.executeHandlingLocks(ClusteredSensitiveExecutorService.java:54) at com.exalate.node.util.concurrent.ClusteredSensitiveExecutorService.executeHandlingLocks(ClusteredSensitiveExecutorService.java:28) at com.exalate.replication.in.RequestWorker.run(RequestWorker.java:81) at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511) at java.util.concurrent.FutureTask.runAndReset(FutureTask.java:308) at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$301(ScheduledThreadPoolExecutor.java:180) at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:294) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) at java.lang.Thread.run(Thread.java:748) Caused by: com.atlassian.jira.exception.CreateException: Error occurred while creating issue through workflow: at
CommentAdd your comment...
Do you have a mapping between the options in the custom field and the components?
issue.components = replica.customFields.“MSL
Component/s”?.value?.value.collect{
nodeHelper.createComponent(
issue,
it.name,
it.description,
it.leadKey,
it.assigneeType.name()
)
}
Is this the correct way to set a component from a single select custom field?
And I need to understand if it duplicates/creates new components or if it sets the component that actually exists in the receiving project.