Questions for Confluence license has expired.

Please purchase a new license to continue using Questions for Confluence.

How do I update a local custom field with the remote issue key in Jira cloud

 
1
0
-1

I've looked at the following doc https://docs.exalate.com/docs/how-to-update-a-local-custom-field-with-the-remote-issue-key

However we are using a visual based connection then using the add script option. I tried adapting the script slightly to fit but I am just getting errors. Can anyone figure out a method to get this working?


if(firstSync){
    syncHelper.syncBackAfterProcessing()
  Jira.issue.customFields."Azure DevOps Key".value = replica.key


com.exalate.domain.exception.editor.ScriptEditorException: com.exalate.admin.editor.errors.mappings.script at com.exalate.replication.services.replication.mapping.MappingService$$anonfun$1.applyOrElse(MappingService.scala:296) at com.exalate.replication.services.replication.mapping.MappingService$$anonfun$1.applyOrElse(MappingService.scala:278) at scala.runtime.AbstractPartialFunction.apply(AbstractPartialFunction.scala:38) at scala.util.Failure.recoverWith(Try.scala:236) at com.exalate.replication.services.replication.mapping.MappingService.executeInScriptRule(MappingService.scala:278) at com.exalate.replication.services.replication.mapping.MappingService.$anonfun$receive$8(MappingService.scala:183) at scala.concurrent.Future.$anonfun$flatMap$1(Future.scala:307) at scala.concurrent.impl.Promise.$anonfun$transformWith$1(Promise.scala:41) at scala.concurrent.impl.CallbackRunnable.run(Promise.scala:64) at akka.dispatch.BatchingExecutor$AbstractBatch.processBatch(BatchingExecutor.scala:63) at akka.dispatch.BatchingExecutor$BlockableBatch.$anonfun$run$1(BatchingExecutor.scala:100) at scala.runtime.java8.JFunction0$mcV$sp.apply(JFunction0$mcV$sp.java:23) at scala.concurrent.BlockContext$.withBlockContext(BlockContext.scala:85) at akka.dispatch.BatchingExecutor$BlockableBatch.run(BatchingExecutor.scala:100) at akka.dispatch.TaskInvocation.run(AbstractDispatcher.scala:49) at akka.dispatch.ForkJoinExecutorConfigurator$AkkaForkJoinTask.exec(ForkJoinExecutorConfigurator.scala:48) at java.base/java.util.concurrent.ForkJoinTask.doExec(ForkJoinTask.java:290) at java.base/java.util.concurrent.ForkJoinPool$WorkQueue.topLevelExec(ForkJoinPool.java:1020) at java.base/java.util.concurrent.ForkJoinPool.scan(ForkJoinPool.java:1656) at java.base/java.util.concurrent.ForkJoinPool.runWorker(ForkJoinPool.java:1594) at java.base/java.util.concurrent.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:183) Caused by: com.exalate.api.exception.script.ScriptException: Cannot set property 'value' on null object at com.exalate.error.services.ScriptExceptionCategoryService.categorizeProcessorAndIssueTrackerExceptionsIntoScriptExceptions(ScriptExceptionCategoryService.scala:39) at com.exalate.processor.ExalateProcessor.executeProcessor(ExalateProcessor.java:57) at com.exalate.replication.services.replication.mapping.MappingService.$anonfun$executeInScriptRule$1(MappingService.scala:274) at scala.util.Try$.apply(Try.scala:213) at com.exalate.replication.services.replication.mapping.MappingService.executeInScriptRule(MappingService.scala:271) ... 16 more Caused by: javax.script.ScriptException: javax.script.ScriptException: java.lang.NullPointerException: Cannot set property 'value' on null object at org.codehaus.groovy.jsr223.GroovyScriptEngineImpl.eval(GroovyScriptEngineImpl.java:158) at java.scripting/javax.script.AbstractScriptEngine.eval(AbstractScriptEngine.java:264) at com.exalate.processor.ExalateProcessor.execute(ExalateProcessor.java:96) at com.exalate.processor.ExalateProcessor.executeProcessor(ExalateProcessor.java:55) ... 19 more Caused by: javax.script.ScriptException: java.lang.NullPointerException: Cannot set property 'value' on null object at org.codehaus.groovy.jsr223.GroovyScriptEngineImpl.eval(GroovyScriptEngineImpl.java:320) at org.codehaus.groovy.jsr223.GroovyScriptEngineImpl.eval(GroovyScriptEngineImpl.java:155) ... 22 more Caused by: java.lang.NullPointerException: Cannot set property 'value' on null object at org.codehaus.groovy.runtime.NullObject.setProperty(NullObject.java:80) at org.codehaus.groovy.runtime.InvokerHelper.setProperty(InvokerHelper.java:213) at org.codehaus.groovy.runtime.ScriptBytecodeAdapter.setProperty(ScriptBytecodeAdapter.java:496) at Script65.run(Script65.groovy:16) at org.codehaus.groovy.jsr223.GroovyScriptEngineImpl.eval(GroovyScriptEngineImpl.java:317) ... 23 more

    CommentAdd your comment...

    3 answers

    1.  
      1
      0
      -1

      Hi James 


      Could I ask you to create an EASE ticket with the Exalate support regarding this along with the support zips? 


      BR, 

      Jillani

      1. James

        Hi Jillani Fazal 

        I already created one its EASE-24323. If you could jump in on that it would be great thanks

      CommentAdd your comment...
    2.  
      1
      0
      -1

      At the bottom of this page it explains how to do it in a visual connection however when trying it I am now getting a different error. https://docs.exalate.com/docs/scripts-in-visual-mode?utm_medium=product&utm_source=exalate_azure_devops


      if(firstSync){
        syncHelper.syncBackAfterProcessing()

      local.issue.customFields."AzureDevOpsKey".value = remote.issue.key


      com.exalate.domain.exception.editor.ScriptEditorException: com.exalate.admin.editor.errors.mappings.script at com.exalate.replication.services.replication.mapping.MappingService$$anonfun$1.applyOrElse(MappingService.scala:296) at com.exalate.replication.services.replication.mapping.MappingService$$anonfun$1.applyOrElse(MappingService.scala:278) at scala.runtime.AbstractPartialFunction.apply(AbstractPartialFunction.scala:38) at scala.util.Failure.recoverWith(Try.scala:236) at com.exalate.replication.services.replication.mapping.MappingService.executeInScriptRule(MappingService.scala:278) at com.exalate.replication.services.replication.mapping.MappingService.$anonfun$receive$8(MappingService.scala:183) at scala.concurrent.Future.$anonfun$flatMap$1(Future.scala:307) at scala.concurrent.impl.Promise.$anonfun$transformWith$1(Promise.scala:41) at scala.concurrent.impl.CallbackRunnable.run(Promise.scala:64) at akka.dispatch.BatchingExecutor$AbstractBatch.processBatch(BatchingExecutor.scala:63) at akka.dispatch.BatchingExecutor$BlockableBatch.$anonfun$run$1(BatchingExecutor.scala:100) at scala.runtime.java8.JFunction0$mcV$sp.apply(JFunction0$mcV$sp.java:23) at scala.concurrent.BlockContext$.withBlockContext(BlockContext.scala:85) at akka.dispatch.BatchingExecutor$BlockableBatch.run(BatchingExecutor.scala:100) at akka.dispatch.TaskInvocation.run(AbstractDispatcher.scala:49) at akka.dispatch.ForkJoinExecutorConfigurator$AkkaForkJoinTask.exec(ForkJoinExecutorConfigurator.scala:48) at java.base/java.util.concurrent.ForkJoinTask.doExec(ForkJoinTask.java:290) at java.base/java.util.concurrent.ForkJoinPool$WorkQueue.topLevelExec(ForkJoinPool.java:1020) at java.base/java.util.concurrent.ForkJoinPool.scan(ForkJoinPool.java:1656) at java.base/java.util.concurrent.ForkJoinPool.runWorker(ForkJoinPool.java:1594) at java.base/java.util.concurrent.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:183) Caused by: com.exalate.api.exception.script.ScriptException: No such property: remote for class: Script34 at com.exalate.error.services.ScriptExceptionCategoryService.categorizeProcessorAndIssueTrackerExceptionsIntoScriptExceptions(ScriptExceptionCategoryService.scala:39) at com.exalate.processor.ExalateProcessor.executeProcessor(ExalateProcessor.java:57) at com.exalate.replication.services.replication.mapping.MappingService.$anonfun$executeInScriptRule$1(MappingService.scala:274) at scala.util.Try$.apply(Try.scala:213) at com.exalate.replication.services.replication.mapping.MappingService.executeInScriptRule(MappingService.scala:271) ... 16 more Caused by: javax.script.ScriptException: javax.script.ScriptException: groovy.lang.MissingPropertyException: No such property: remote for class: Script34 at org.codehaus.groovy.jsr223.GroovyScriptEngineImpl.eval(GroovyScriptEngineImpl.java:158) at java.scripting/javax.script.AbstractScriptEngine.eval(AbstractScriptEngine.java:264) at com.exalate.processor.ExalateProcessor.execute(ExalateProcessor.java:96) at com.exalate.processor.ExalateProcessor.executeProcessor(ExalateProcessor.java:55) ... 19 more Caused by: javax.script.ScriptException: groovy.lang.MissingPropertyException: No such property: remote for class: Script34 at org.codehaus.groovy.jsr223.GroovyScriptEngineImpl.eval(GroovyScriptEngineImpl.java:320) at org.codehaus.groovy.jsr223.GroovyScriptEngineImpl.eval(GroovyScriptEngineImpl.java:155) ... 22 more Caused by: groovy.lang.MissingPropertyException: No such property: remote for class: Script34 at org.codehaus.groovy.runtime.ScriptBytecodeAdapter.unwrap(ScriptBytecodeAdapter.java:65) at org.codehaus.groovy.runtime.callsite.PogoGetPropertySite.getProperty(PogoGetPropertySite.java:51) at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callGroovyObjectGetProperty(AbstractCallSite.java:309) at Script34.run(Script34.groovy:22) at org.codehaus.groovy.jsr223.GroovyScriptEngineImpl.eval(GroovyScriptEngineImpl.java:317) ... 23 more

        CommentAdd your comment...
      1.  
        1
        0
        -1

        Hi James,


        Can you try changing the line:

        Jira.issue.customFields."Azure DevOps Key".value = replica.key


        The object you working with is "issue", no "Jira" prefix.


        Regards,

        Stéphane


        1. James

          Hi Stéphane,

          Thanks for the reply, I tried removing the Jira instance name as you said but still seem to be getting the following error


          com.exalate.domain.exception.editor.ScriptEditorException: com.exalate.admin.editor.errors.mappings.script at com.exalate.replication.services.replication.mapping.MappingService$$anonfun$1.applyOrElse(MappingService.scala:296) at com.exalate.replication.services.replication.mapping.MappingService$$anonfun$1.applyOrElse(MappingService.scala:278) at scala.runtime.AbstractPartialFunction.apply(AbstractPartialFunction.scala:38) at scala.util.Failure.recoverWith(Try.scala:236) at com.exalate.replication.services.replication.mapping.MappingService.executeInScriptRule(MappingService.scala:278) at com.exalate.replication.services.replication.mapping.MappingService.$anonfun$receive$8(MappingService.scala:183) at scala.concurrent.Future.$anonfun$flatMap$1(Future.scala:307) at scala.concurrent.impl.Promise.$anonfun$transformWith$1(Promise.scala:41) at scala.concurrent.impl.CallbackRunnable.run(Promise.scala:64) at akka.dispatch.BatchingExecutor$AbstractBatch.processBatch(BatchingExecutor.scala:63) at akka.dispatch.BatchingExecutor$BlockableBatch.$anonfun$run$1(BatchingExecutor.scala:100) at scala.runtime.java8.JFunction0$mcV$sp.apply(JFunction0$mcV$sp.java:23) at scala.concurrent.BlockContext$.withBlockContext(BlockContext.scala:85) at akka.dispatch.BatchingExecutor$BlockableBatch.run(BatchingExecutor.scala:100) at akka.dispatch.TaskInvocation.run(AbstractDispatcher.scala:49) at akka.dispatch.ForkJoinExecutorConfigurator$AkkaForkJoinTask.exec(ForkJoinExecutorConfigurator.scala:48) at java.base/java.util.concurrent.ForkJoinTask.doExec(ForkJoinTask.java:290) at java.base/java.util.concurrent.ForkJoinPool$WorkQueue.topLevelExec(ForkJoinPool.java:1020) at java.base/java.util.concurrent.ForkJoinPool.scan(ForkJoinPool.java:1656) at java.base/java.util.concurrent.ForkJoinPool.runWorker(ForkJoinPool.java:1594) at java.base/java.util.concurrent.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:183) Caused by: com.exalate.api.exception.script.ScriptException: Cannot set property 'value' on null object at com.exalate.error.services.ScriptExceptionCategoryService.categorizeProcessorAndIssueTrackerExceptionsIntoScriptExceptions(ScriptExceptionCategoryService.scala:39) at com.exalate.processor.ExalateProcessor.executeProcessor(ExalateProcessor.java:57) at com.exalate.replication.services.replication.mapping.MappingService.$anonfun$executeInScriptRule$1(MappingService.scala:274) at scala.util.Try$.apply(Try.scala:213) at com.exalate.replication.services.replication.mapping.MappingService.executeInScriptRule(MappingService.scala:271) ... 16 more Caused by: javax.script.ScriptException: javax.script.ScriptException: java.lang.NullPointerException: Cannot set property 'value' on null object at org.codehaus.groovy.jsr223.GroovyScriptEngineImpl.eval(GroovyScriptEngineImpl.java:158) at java.scripting/javax.script.AbstractScriptEngine.eval(AbstractScriptEngine.java:264) at com.exalate.processor.ExalateProcessor.execute(ExalateProcessor.java:96) at com.exalate.processor.ExalateProcessor.executeProcessor(ExalateProcessor.java:55) ... 19 more Caused by: javax.script.ScriptException: java.lang.NullPointerException: Cannot set property 'value' on null object at org.codehaus.groovy.jsr223.GroovyScriptEngineImpl.eval(GroovyScriptEngineImpl.java:320) at org.codehaus.groovy.jsr223.GroovyScriptEngineImpl.eval(GroovyScriptEngineImpl.java:155) ... 22 more Caused by: java.lang.NullPointerException: Cannot set property 'value' on null object at org.codehaus.groovy.runtime.NullObject.setProperty(NullObject.java:80) at org.codehaus.groovy.runtime.InvokerHelper.setProperty(InvokerHelper.java:213) at org.codehaus.groovy.runtime.ScriptBytecodeAdapter.setProperty(ScriptBytecodeAdapter.java:496) at Script66.run(Script66.groovy:16) at org.codehaus.groovy.jsr223.GroovyScriptEngineImpl.eval(GroovyScriptEngineImpl.java:317) ... 23 more

        2. Stéphane Thillay

          Hi James,


          The root cause seems to be "Cannot set property 'value' on null object at..." but the logs are truncated so we don't get more details.


          I can only assume there is something wrong when getting

             issue.customFields."Azure DevOps Key".value

          Does the "Azure DevOps Key" field exists? (any typo in the name)


          Regards,

          Stéphane

        3. James

          Yes the field exists and is spelt correctly, but obviously is empty as the sync should populate it. 

          I could try using the Jira custom Field ID instead of the name?

        4. James

          Just tried it with a different custom field without any spaces in it and still get the same error. Also tried with the custom field ID and same error

        5. Alastair Wade

          Hey Stéphane,

          Not sure how helpful this is but I am doing exactly what you are trying to do but between Jira and Zendesk. My incoming Zendesk script that works is:

          issue."Jira Issue Key" = replica.key

          I did add .value to start with but got the error you are seeing. I also found no need for customFields too but you might want to check this with/without. Anyway, as I say, this is working for me so maybe worth a try.   


        6. James

          Thanks for the suggestion Alastair Wade, unfortunately still erroring out for me

        CommentAdd your comment...